tx · 2cbti4SgpymdEkYDC1zUipLb57wxgsfRmPJsBFaeFtDA

3NAYgaLaVNNh5qw3Zx5PydFoE7mSoqYvP2H:  -0.04200000 Waves

2023.04.06 12:52 [2522546] smart account 3NAYgaLaVNNh5qw3Zx5PydFoE7mSoqYvP2H > SELF 0.00000000 Waves

{ "type": 13, "id": "2cbti4SgpymdEkYDC1zUipLb57wxgsfRmPJsBFaeFtDA", "fee": 4200000, "feeAssetId": null, "timestamp": 1680774791337, "version": 2, "chainId": 84, "sender": "3NAYgaLaVNNh5qw3Zx5PydFoE7mSoqYvP2H", "senderPublicKey": "BNZJaZQpQutteRwUttAsDbWkozgmUAAjBrkxaaYMuV8", "proofs": [ "3oD6zX57Hjjz7Lk88F6avsDahisuG9UDyHrrrk4gZ4j83ZgvJ7twqmKrw95uLKDRSdGE3jULaC2ug7ViWQqzxt35" ], "script": "base64:BgK9NwgCEgASBQoDAQQBEgcKBQEEAQgBEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUFtdEFzc2V0SWQiE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JpbAcJAPQDAwgFAmlnCWJvZHlCeXRlcwkAkQMCCAUCaWcGcHJvb2ZzAAAFAmlpzVFmaQ==", "height": 2522546, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8DhJiHJ4hD2H3D2yY2qnA82UV6RfJt5rRLmUp1EisSgk Next: J6WFXeska4TViibs5SwMM8puGw5QwKkQZGiuiH626trR Diff:
OldNewDifferences
372372 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
373373 if ((currentStakingAssetBalance == currentStakingAssetBalance))
374374 then {
375- let availableBalance = match parseAssetId(assetId) {
376- case b: ByteVector =>
377- assetBalance(this, b)
378- case u: Unit =>
379- wavesBalance(this).available
380- case _ =>
381- throw("Match error")
382- }
383- if ((availableBalance == availableBalance))
384- then {
385- let wholeBalance = max([0, ((availableBalance + currentAdditionalBalance) - minBalance)])
386- let targetAdditionalBalance = fraction(targetRatio, wholeBalance, 100)
387- let diff = (currentAdditionalBalance - targetAdditionalBalance)
388- if ((diff == 0))
389- then nil
390- else if ((0 > diff))
391- then {
392- let sendAssetAmount = -(diff)
393- deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
394- }
395- else {
396- let getAssetAmount = diff
397- withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
398- }
399- }
400- else throw("Strict value is not equal to itself.")
375+ let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)])
376+ let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100)
377+ let diff = (currentAdditionalBalance - targetAdditionalBalance)
378+ if ((diff == 0))
379+ then nil
380+ else if ((0 > diff))
381+ then {
382+ let sendAssetAmount = -(diff)
383+ deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
384+ }
385+ else {
386+ let getAssetAmount = diff
387+ withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
388+ }
401389 }
402390 else throw("Strict value is not equal to itself.")
403391 }
406394
407395
408396 func rebalanceAsset (assetId) = {
409- let $t01552715663 = getLeaseProxyConfig(assetId)
410- let isLeasable = $t01552715663._1
411- let leasedRatio = $t01552715663._2
412- let minBalance = $t01552715663._3
413- let proxyAddress = $t01552715663._4
414- let proxyAssetId = $t01552715663._5
415- let proxyRateMul = $t01552715663._6
416- let stakingProfitAddress = $t01552715663._7
397+ let $t01536415500 = getLeaseProxyConfig(assetId)
398+ let isLeasable = $t01536415500._1
399+ let leasedRatio = $t01536415500._2
400+ let minBalance = $t01536415500._3
401+ let proxyAddress = $t01536415500._4
402+ let proxyAssetId = $t01536415500._5
403+ let proxyRateMul = $t01536415500._6
404+ let stakingProfitAddress = $t01536415500._7
417405 if (isLeasable)
418406 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
419407 else nil
421409
422410
423411 func withdrawAndRebalanceAsset (assetId,getAmount) = {
424- let $t01605216188 = getLeaseProxyConfig(assetId)
425- let isLeasable = $t01605216188._1
426- let leasedRatio = $t01605216188._2
427- let minBalance = $t01605216188._3
428- let proxyAddress = $t01605216188._4
429- let proxyAssetId = $t01605216188._5
430- let proxyRateMul = $t01605216188._6
431- let stakingProfitAddress = $t01605216188._7
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
432420 if (isLeasable)
433421 then {
434- let newTotalCalcBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
435- if ((newTotalCalcBalance == newTotalCalcBalance))
422+ let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
423+ if ((newTotalLeasableBalance == newTotalLeasableBalance))
436424 then {
437- let newAdditionalBalance = fraction(leasedRatio, newTotalCalcBalance, 100)
425+ let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
438426 if ((newAdditionalBalance == newAdditionalBalance))
439427 then {
440428 let withdrawAmount = max([0, (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)])
636624 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
637625 let amountAssetAmount = order.amount
638626 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
639- let $t02830828520 = if ((order.orderType == Buy))
627+ let $t02815328365 = if ((order.orderType == Buy))
640628 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
641629 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
642- let amountAssetBalanceDelta = $t02830828520._1
643- let priceAssetBalanceDelta = $t02830828520._2
630+ let amountAssetBalanceDelta = $t02815328365._1
631+ let priceAssetBalanceDelta = $t02815328365._2
644632 if (if (if (isGlobalShutdown())
645633 then true
646634 else (cfgPoolStatus == PoolMatcherDisabled))
653641 then throw("Wrong order assets.")
654642 else {
655643 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
656- let $t02896029060 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
657- let unusedActions = $t02896029060._1
658- let kLpNew = $t02896029060._2
644+ let $t02880528905 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
645+ let unusedActions = $t02880528905._1
646+ let kLpNew = $t02880528905._2
659647 let isOrderValid = (kLpNew >= kLp)
660648 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
661649 $Tuple2(isOrderValid, info)
734722 else if ((paymentAssetId == cfgPriceAssetId))
735723 then false
736724 else throwErr("invalid asset")
737- let $t03217332466 = if (isEval)
725+ let $t03201832311 = if (isEval)
738726 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
739727 else if (paymentInAmountAsset)
740728 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
741729 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
742- let amountBalanceOld = $t03217332466._1
743- let priceBalanceOld = $t03217332466._2
744- let $t03247032619 = if (paymentInAmountAsset)
730+ let amountBalanceOld = $t03201832311._1
731+ let priceBalanceOld = $t03201832311._2
732+ let $t03231532464 = if (paymentInAmountAsset)
745733 then $Tuple2(paymentAmountRaw, 0)
746734 else $Tuple2(0, paymentAmountRaw)
747- let amountAssetAmountRaw = $t03247032619._1
748- let priceAssetAmountRaw = $t03247032619._2
735+ let amountAssetAmountRaw = $t03231532464._1
736+ let priceAssetAmountRaw = $t03231532464._2
749737 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
750738 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
751- let $t03275132815 = takeFee(paymentAmountRaw, inFee)
752- let paymentAmount = $t03275132815._1
753- let feeAmount = $t03275132815._2
739+ let $t03259632660 = takeFee(paymentAmountRaw, inFee)
740+ let paymentAmount = $t03259632660._1
741+ let feeAmount = $t03259632660._2
754742 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
755743 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
756744 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
773761 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
774762 let priceOld = fromX18(priceOldX18, scale8)
775763 let loss = {
776- let $t03449634663 = if (paymentInAmountAsset)
764+ let $t03434134508 = if (paymentInAmountAsset)
777765 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
778766 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
779- let amount = $t03449634663._1
780- let balance = $t03449634663._2
767+ let amount = $t03434134508._1
768+ let balance = $t03434134508._2
781769 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
782770 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
783771 }
817805 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
818806 let redeemedBigInt = toBigInt(paymentAmount)
819807 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
820- let $t03674136797 = takeFee(amountRaw, outFee)
821- let totalAmount = $t03674136797._1
822- let feeAmount = $t03674136797._2
823- let $t03680137027 = if (outInAmountAsset)
808+ let $t03658636642 = takeFee(amountRaw, outFee)
809+ let totalAmount = $t03658636642._1
810+ let feeAmount = $t03658636642._2
811+ let $t03664636872 = if (outInAmountAsset)
824812 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
825813 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
826- let outAmAmount = $t03680137027._1
827- let outPrAmount = $t03680137027._2
828- let amBalanceNew = $t03680137027._3
829- let prBalanceNew = $t03680137027._4
814+ let outAmAmount = $t03664636872._1
815+ let outPrAmount = $t03664636872._2
816+ let amBalanceNew = $t03664636872._3
817+ let prBalanceNew = $t03664636872._4
830818 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
831819 let priceNew = fromX18(priceNewX18, scale8)
832820 let commonState = if (isEval)
898886
899887 @Callable(i)
900888 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
901- let $t03891339218 = if ((isReverse == false))
889+ let $t03875839063 = if ((isReverse == false))
902890 then {
903891 let assetOut = getStringOrFail(this, pa())
904892 let assetIn = getStringOrFail(this, aa())
909897 let assetIn = getStringOrFail(this, pa())
910898 $Tuple2(assetOut, assetIn)
911899 }
912- let assetOut = $t03891339218._1
913- let assetIn = $t03891339218._2
900+ let assetOut = $t03875839063._1
901+ let assetIn = $t03875839063._2
914902 let poolAssetInBalance = getAccBalance(assetIn)
915903 let poolAssetOutBalance = getAccBalance(assetOut)
916904 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
10611049 else throw("Strict value is not equal to itself.")
10621050 }
10631051 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1064- let $t04426444726 = refreshKLpInternal(0, 0, 0)
1065- if (($t04426444726 == $t04426444726))
1052+ let $t04410944571 = refreshKLpInternal(0, 0, 0)
1053+ if (($t04410944571 == $t04410944571))
10661054 then {
1067- let updatedKLp = $t04426444726._2
1068- let refreshKLpActions = $t04426444726._1
1055+ let updatedKLp = $t04410944571._2
1056+ let refreshKLpActions = $t04410944571._1
10691057 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10701058 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10711059 then {
11021090 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
11031091 if ((currentKLp == currentKLp))
11041092 then {
1105- let $t04533845403 = refreshKLpInternal(0, 0, 0)
1106- let refreshKLpActions = $t04533845403._1
1107- let updatedKLp = $t04533845403._2
1093+ let $t04518345248 = refreshKLpInternal(0, 0, 0)
1094+ let refreshKLpActions = $t04518345248._1
1095+ let updatedKLp = $t04518345248._2
11081096 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11091097 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11101098 then (state ++ refreshKLpActions)
11511139 then {
11521140 let userAddress = i.caller
11531141 let txId = i.transactionId
1154- let $t04659146743 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1155- if (($t04659146743 == $t04659146743))
1142+ let $t04643646588 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1143+ if (($t04643646588 == $t04643646588))
11561144 then {
1157- let paymentInAmountAsset = $t04659146743._5
1158- let bonus = $t04659146743._4
1159- let feeAmount = $t04659146743._3
1160- let commonState = $t04659146743._2
1161- let emitAmountEstimated = $t04659146743._1
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
11621150 let emitAmount = if (if ((minOutAmount > 0))
11631151 then (minOutAmount > emitAmountEstimated)
11641152 else false)
11781166 let sendFee = if ((feeAmount > 0))
11791167 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11801168 else nil
1181- let $t04732947526 = if ((this == feeCollectorAddress))
1169+ let $t04717447371 = if ((this == feeCollectorAddress))
11821170 then $Tuple2(0, 0)
11831171 else if (paymentInAmountAsset)
11841172 then $Tuple2(-(feeAmount), 0)
11851173 else $Tuple2(0, -(feeAmount))
1186- let amountAssetBalanceDelta = $t04732947526._1
1187- let priceAssetBalanceDelta = $t04732947526._2
1188- let $t04752947637 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1189- let refreshKLpActions = $t04752947637._1
1190- let updatedKLp = $t04752947637._2
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
11911179 let kLp = value(getString(keyKLp))
11921180 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11931181 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12121200
12131201 @Callable(i)
12141202 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1215- let $t04799248149 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1216- let emitAmountEstimated = $t04799248149._1
1217- let commonState = $t04799248149._2
1218- let feeAmount = $t04799248149._3
1219- let bonus = $t04799248149._4
1220- let paymentInAmountAsset = $t04799248149._5
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
12211209 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12221210 }
12231211
12541242 then {
12551243 let userAddress = i.caller
12561244 let txId = i.transactionId
1257- let $t04903449187 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1258- if (($t04903449187 == $t04903449187))
1245+ let $t04887949032 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1246+ if (($t04887949032 == $t04887949032))
12591247 then {
1260- let outInAmountAsset = $t04903449187._5
1261- let bonus = $t04903449187._4
1262- let feeAmount = $t04903449187._3
1263- let commonState = $t04903449187._2
1264- let amountEstimated = $t04903449187._1
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
12651253 let amount = if (if ((minOutAmount > 0))
12661254 then (minOutAmount > amountEstimated)
12671255 else false)
12751263 let sendFee = if ((feeAmount > 0))
12761264 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12771265 else nil
1278- let $t04975850005 = {
1266+ let $t04960349850 = {
12791267 let feeAmountForCalc = if ((this == feeCollectorAddress))
12801268 then 0
12811269 else feeAmount
12831271 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12841272 else $Tuple2(0, -((amount + feeAmountForCalc)))
12851273 }
1286- let amountAssetBalanceDelta = $t04975850005._1
1287- let priceAssetBalanceDelta = $t04975850005._2
1288- let $t05000850116 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1289- let refreshKLpActions = $t05000850116._1
1290- let updatedKLp = $t05000850116._2
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
12911279 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12921280 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12931281 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13061294
13071295 @Callable(i)
13081296 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1309- let $t05039450550 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1310- let amountEstimated = $t05039450550._1
1311- let commonState = $t05039450550._2
1312- let feeAmount = $t05039450550._3
1313- let bonus = $t05039450550._4
1314- let outInAmountAsset = $t05039450550._5
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
13151303 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13161304 }
13171305
13481336 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13491337 if ((unstakeInv == unstakeInv))
13501338 then {
1351- let $t05145551606 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1352- if (($t05145551606 == $t05145551606))
1339+ let $t05130051451 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1340+ if (($t05130051451 == $t05130051451))
13531341 then {
1354- let outInAmountAsset = $t05145551606._5
1355- let bonus = $t05145551606._4
1356- let feeAmount = $t05145551606._3
1357- let commonState = $t05145551606._2
1358- let amountEstimated = $t05145551606._1
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
13591347 let amount = if (if ((minOutAmount > 0))
13601348 then (minOutAmount > amountEstimated)
13611349 else false)
13691357 let sendFee = if ((feeAmount > 0))
13701358 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13711359 else nil
1372- let $t05217252419 = {
1360+ let $t05201752264 = {
13731361 let feeAmountForCalc = if ((this == feeCollectorAddress))
13741362 then 0
13751363 else feeAmount
13771365 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13781366 else $Tuple2(0, -((amount + feeAmountForCalc)))
13791367 }
1380- let amountAssetBalanceDelta = $t05217252419._1
1381- let priceAssetBalanceDelta = $t05217252419._2
1382- let $t05242252530 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1383- let refreshKLpActions = $t05242252530._1
1384- let updatedKLp = $t05242252530._2
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
13851373 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13861374 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13871375 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
14151403 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14161404 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14171405 then {
1418- let $t05362553706 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1419- let refreshKLpActions = $t05362553706._1
1420- let updatedKLp = $t05362553706._2
1406+ let $t05347053551 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1407+ let refreshKLpActions = $t05347053551._1
1408+ let updatedKLp = $t05347053551._2
14211409 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14221410 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14231411 then ((withdrawState ++ state) ++ refreshKLpActions)
14501438 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14511439 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14521440 then {
1453- let $t05480154882 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1454- let refreshKLpActions = $t05480154882._1
1455- let updatedKLp = $t05480154882._2
1441+ let $t05464654727 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1442+ let refreshKLpActions = $t05464654727._1
1443+ let updatedKLp = $t05464654727._2
14561444 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14571445 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14581446 then ((withdrawState ++ state) ++ refreshKLpActions)
14971485 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14981486 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14991487 then {
1500- let $t05615456235 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1501- let refreshKLpActions = $t05615456235._1
1502- let updatedKLp = $t05615456235._2
1488+ let $t05599956080 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1489+ let refreshKLpActions = $t05599956080._1
1490+ let updatedKLp = $t05599956080._2
15031491 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15041492 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15051493 then ((withdrawState ++ state) ++ refreshKLpActions)
15511539 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15521540 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15531541 then {
1554- let $t05767657757 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1555- let refreshKLpActions = $t05767657757._1
1556- let updatedKLp = $t05767657757._2
1542+ let $t05752157602 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1543+ let refreshKLpActions = $t05752157602._1
1544+ let updatedKLp = $t05752157602._2
15571545 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15581546 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15591547 then ((withdrawState ++ state) ++ refreshKLpActions)
15881576 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15891577 then {
15901578 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1591- let $t05896159025 = refreshKLpInternal(0, 0, 0)
1592- let kLpUpdateActions = $t05896159025._1
1593- let updatedKLp = $t05896159025._2
1579+ let $t05880658870 = refreshKLpInternal(0, 0, 0)
1580+ let kLpUpdateActions = $t05880658870._1
1581+ let updatedKLp = $t05880658870._2
15941582 let actions = if ((kLp != updatedKLp))
15951583 then kLpUpdateActions
15961584 else throwErr("nothing to refresh")
17651753 match tx {
17661754 case order: Order =>
17671755 let matcherPub = getMatcherPubOrFail()
1768- let $t06768767756 = validateMatcherOrderAllowed(order)
1769- let orderValid = $t06768767756._1
1770- let orderValidInfo = $t06768767756._2
1756+ let $t06753267601 = validateMatcherOrderAllowed(order)
1757+ let orderValid = $t06753267601._1
1758+ let orderValidInfo = $t06753267601._2
17711759 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17721760 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17731761 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 {
375- let availableBalance = match parseAssetId(assetId) {
376- case b: ByteVector =>
377- assetBalance(this, b)
378- case u: Unit =>
379- wavesBalance(this).available
380- case _ =>
381- throw("Match error")
382- }
383- if ((availableBalance == availableBalance))
384- then {
385- let wholeBalance = max([0, ((availableBalance + currentAdditionalBalance) - minBalance)])
386- let targetAdditionalBalance = fraction(targetRatio, wholeBalance, 100)
387- let diff = (currentAdditionalBalance - targetAdditionalBalance)
388- if ((diff == 0))
389- then nil
390- else if ((0 > diff))
391- then {
392- let sendAssetAmount = -(diff)
393- deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
394- }
395- else {
396- let getAssetAmount = diff
397- withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
398- }
399- }
400- else throw("Strict value is not equal to itself.")
375+ let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)])
376+ let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100)
377+ let diff = (currentAdditionalBalance - targetAdditionalBalance)
378+ if ((diff == 0))
379+ then nil
380+ else if ((0 > diff))
381+ then {
382+ let sendAssetAmount = -(diff)
383+ deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
384+ }
385+ else {
386+ let getAssetAmount = diff
387+ withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
388+ }
401389 }
402390 else throw("Strict value is not equal to itself.")
403391 }
404392 else throw("Strict value is not equal to itself.")
405393 }
406394
407395
408396 func rebalanceAsset (assetId) = {
409- let $t01552715663 = getLeaseProxyConfig(assetId)
410- let isLeasable = $t01552715663._1
411- let leasedRatio = $t01552715663._2
412- let minBalance = $t01552715663._3
413- let proxyAddress = $t01552715663._4
414- let proxyAssetId = $t01552715663._5
415- let proxyRateMul = $t01552715663._6
416- let stakingProfitAddress = $t01552715663._7
397+ let $t01536415500 = getLeaseProxyConfig(assetId)
398+ let isLeasable = $t01536415500._1
399+ let leasedRatio = $t01536415500._2
400+ let minBalance = $t01536415500._3
401+ let proxyAddress = $t01536415500._4
402+ let proxyAssetId = $t01536415500._5
403+ let proxyRateMul = $t01536415500._6
404+ let stakingProfitAddress = $t01536415500._7
417405 if (isLeasable)
418406 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
419407 else nil
420408 }
421409
422410
423411 func withdrawAndRebalanceAsset (assetId,getAmount) = {
424- let $t01605216188 = getLeaseProxyConfig(assetId)
425- let isLeasable = $t01605216188._1
426- let leasedRatio = $t01605216188._2
427- let minBalance = $t01605216188._3
428- let proxyAddress = $t01605216188._4
429- let proxyAssetId = $t01605216188._5
430- let proxyRateMul = $t01605216188._6
431- let stakingProfitAddress = $t01605216188._7
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
432420 if (isLeasable)
433421 then {
434- let newTotalCalcBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
435- if ((newTotalCalcBalance == newTotalCalcBalance))
422+ let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
423+ if ((newTotalLeasableBalance == newTotalLeasableBalance))
436424 then {
437- let newAdditionalBalance = fraction(leasedRatio, newTotalCalcBalance, 100)
425+ let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
438426 if ((newAdditionalBalance == newAdditionalBalance))
439427 then {
440428 let withdrawAmount = max([0, (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)])
441429 if ((withdrawAmount == withdrawAmount))
442430 then withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
443431 else throw("Strict value is not equal to itself.")
444432 }
445433 else throw("Strict value is not equal to itself.")
446434 }
447435 else throw("Strict value is not equal to itself.")
448436 }
449437 else nil
450438 }
451439
452440
453441 func withdrawAndRebalanceAll (amountAssetOutAmount,priceAssetOutAmount) = {
454442 let AmAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, aa()), amountAssetOutAmount)
455443 let PrAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, pa()), priceAssetOutAmount)
456444 (AmAmtWithdrawState ++ PrAmtWithdrawState)
457445 }
458446
459447
460448 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
461449 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
462450 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
463451 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
464452 }
465453
466454
467455 func calcPrices (amAmt,prAmt,lpAmt) = {
468456 let cfg = getPoolConfig()
469457 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
470458 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
471459 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
472460 let amAmtX18 = toX18(amAmt, amtAssetDcm)
473461 let prAmtX18 = toX18(prAmt, priceAssetDcm)
474462 let lpAmtX18 = toX18(lpAmt, scale8)
475463 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
476464 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
477465 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
478466 }
479467
480468
481469 func calculatePrices (amAmt,prAmt,lpAmt) = {
482470 let prices = calcPrices(amAmt, prAmt, lpAmt)
483471 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
484472 }
485473
486474
487475 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
488476 let cfg = getPoolConfig()
489477 let lpAssetId = cfg[idxPoolLPAssetId]
490478 let amAssetId = cfg[idxAmtAssetId]
491479 let prAssetId = cfg[idxPriceAssetId]
492480 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
493481 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
494482 let poolStatus = cfg[idxPoolStatus]
495483 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
496484 if ((lpAssetId != pmtAssetId))
497485 then throw("Invalid asset passed.")
498486 else {
499487 let amBalance = getAccBalance(amAssetId)
500488 let amBalanceX18 = toX18(amBalance, amAssetDcm)
501489 let prBalance = getAccBalance(prAssetId)
502490 let prBalanceX18 = toX18(prBalance, prAssetDcm)
503491 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
504492 let curPrice = fromX18(curPriceX18, scale8)
505493 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
506494 let lpEmissionX18 = toX18(lpEmission, scale8)
507495 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
508496 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
509497 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
510498 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
511499 let state = if ((txId58 == ""))
512500 then nil
513501 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
514502 then unit
515503 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
516504 then unit
517505 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)]
518506 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
519507 }
520508 }
521509
522510
523511 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
524512 let cfg = getPoolConfig()
525513 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
526514 let amAssetIdStr = cfg[idxAmtAssetId]
527515 let prAssetIdStr = cfg[idxPriceAssetId]
528516 let iAmtAssetId = cfg[idxIAmtAssetId]
529517 let iPriceAssetId = cfg[idxIPriceAssetId]
530518 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
531519 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
532520 let poolStatus = cfg[idxPoolStatus]
533521 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
534522 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
535523 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
536524 if (if ((amAssetIdStr != inAmAssetIdStr))
537525 then true
538526 else (prAssetIdStr != inPrAssetIdStr))
539527 then throw("Invalid amt or price asset passed.")
540528 else {
541529 let amBalance = if (isEvaluate)
542530 then getAccBalance(amAssetIdStr)
543531 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
544532 let prBalance = if (isEvaluate)
545533 then getAccBalance(prAssetIdStr)
546534 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
547535 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
548536 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
549537 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
550538 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
551539 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
552540 let res = if ((lpEmission == 0))
553541 then {
554542 let curPriceX18 = zeroBigInt
555543 let slippageX18 = zeroBigInt
556544 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
557545 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
558546 }
559547 else {
560548 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
561549 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
562550 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
563551 if (if ((curPriceX18 != zeroBigInt))
564552 then (slippageX18 > slippageToleranceX18)
565553 else false)
566554 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
567555 else {
568556 let lpEmissionX18 = toX18(lpEmission, scale8)
569557 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
570558 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
571559 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
572560 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
573561 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
574562 let expAmtAssetAmtX18 = expectedAmts._1
575563 let expPriceAssetAmtX18 = expectedAmts._2
576564 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
577565 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
578566 }
579567 }
580568 let calcLpAmt = res._1
581569 let calcAmAssetPmt = res._2
582570 let calcPrAssetPmt = res._3
583571 let curPrice = fromX18(res._4, scale8)
584572 let slippageCalc = fromX18(res._5, scale8)
585573 if ((0 >= calcLpAmt))
586574 then throw("Invalid calculations. LP calculated is less than zero.")
587575 else {
588576 let emitLpAmt = if (!(emitLp))
589577 then 0
590578 else calcLpAmt
591579 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
592580 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
593581 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))]
594582 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
595583 }
596584 }
597585 }
598586
599587
600588 func calcKLp (amountBalance,priceBalance,lpEmission) = {
601589 let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals))
602590 let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))
603591 let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
604592 if ((lpEmission == big0))
605593 then big0
606594 else updatedKLp
607595 }
608596
609597
610598 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
611599 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
612600 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
613601 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
614602 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
615603 currentKLp
616604 }
617605
618606
619607 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
620608 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
621609 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
622610 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
623611 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
624612 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
625613 $Tuple2(actions, updatedKLp)
626614 }
627615
628616
629617 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
630618 then true
631619 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
632620
633621
634622 func validateMatcherOrderAllowed (order) = {
635623 let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
636624 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
637625 let amountAssetAmount = order.amount
638626 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
639- let $t02830828520 = if ((order.orderType == Buy))
627+ let $t02815328365 = if ((order.orderType == Buy))
640628 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
641629 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
642- let amountAssetBalanceDelta = $t02830828520._1
643- let priceAssetBalanceDelta = $t02830828520._2
630+ let amountAssetBalanceDelta = $t02815328365._1
631+ let priceAssetBalanceDelta = $t02815328365._2
644632 if (if (if (isGlobalShutdown())
645633 then true
646634 else (cfgPoolStatus == PoolMatcherDisabled))
647635 then true
648636 else (cfgPoolStatus == PoolShutdown))
649637 then throw("Exchange operations disabled")
650638 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
651639 then true
652640 else (order.assetPair.priceAsset != cfgPriceAssetId))
653641 then throw("Wrong order assets.")
654642 else {
655643 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
656- let $t02896029060 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
657- let unusedActions = $t02896029060._1
658- let kLpNew = $t02896029060._2
644+ let $t02880528905 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
645+ let unusedActions = $t02880528905._1
646+ let kLpNew = $t02880528905._2
659647 let isOrderValid = (kLpNew >= kLp)
660648 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
661649 $Tuple2(isOrderValid, info)
662650 }
663651 }
664652
665653
666654 func commonGet (i) = if ((size(i.payments) != 1))
667655 then throw("exactly 1 payment is expected")
668656 else {
669657 let pmt = value(i.payments[0])
670658 let pmtAssetId = value(pmt.assetId)
671659 let pmtAmt = pmt.amount
672660 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
673661 let outAmAmt = res._1
674662 let outPrAmt = res._2
675663 let poolStatus = parseIntValue(res._9)
676664 let state = res._10
677665 if (if (isGlobalShutdown())
678666 then true
679667 else (poolStatus == PoolShutdown))
680668 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
681669 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
682670 }
683671
684672
685673 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
686674 then throw("exactly 2 payments are expected")
687675 else {
688676 let amAssetPmt = value(i.payments[0])
689677 let prAssetPmt = value(i.payments[1])
690678 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
691679 let poolStatus = parseIntValue(estPut._8)
692680 if (if (if (isGlobalShutdown())
693681 then true
694682 else (poolStatus == PoolPutDisabled))
695683 then true
696684 else (poolStatus == PoolShutdown))
697685 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
698686 else estPut
699687 }
700688
701689
702690 func emit (amount) = {
703691 let emitInv = invoke(factoryContract, "emit", [amount], nil)
704692 if ((emitInv == emitInv))
705693 then {
706694 let emitInvLegacy = match emitInv {
707695 case legacyFactoryContract: Address =>
708696 invoke(legacyFactoryContract, "emit", [amount], nil)
709697 case _ =>
710698 unit
711699 }
712700 if ((emitInvLegacy == emitInvLegacy))
713701 then amount
714702 else throw("Strict value is not equal to itself.")
715703 }
716704 else throw("Strict value is not equal to itself.")
717705 }
718706
719707
720708 func takeFee (amount,fee) = {
721709 let feeAmount = if ((fee == 0))
722710 then 0
723711 else fraction(amount, fee, scale8)
724712 $Tuple2((amount - feeAmount), feeAmount)
725713 }
726714
727715
728716 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
729717 let isEval = (txId == unit)
730718 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
731719 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
732720 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
733721 then true
734722 else if ((paymentAssetId == cfgPriceAssetId))
735723 then false
736724 else throwErr("invalid asset")
737- let $t03217332466 = if (isEval)
725+ let $t03201832311 = if (isEval)
738726 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
739727 else if (paymentInAmountAsset)
740728 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
741729 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
742- let amountBalanceOld = $t03217332466._1
743- let priceBalanceOld = $t03217332466._2
744- let $t03247032619 = if (paymentInAmountAsset)
730+ let amountBalanceOld = $t03201832311._1
731+ let priceBalanceOld = $t03201832311._2
732+ let $t03231532464 = if (paymentInAmountAsset)
745733 then $Tuple2(paymentAmountRaw, 0)
746734 else $Tuple2(0, paymentAmountRaw)
747- let amountAssetAmountRaw = $t03247032619._1
748- let priceAssetAmountRaw = $t03247032619._2
735+ let amountAssetAmountRaw = $t03231532464._1
736+ let priceAssetAmountRaw = $t03231532464._2
749737 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
750738 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
751- let $t03275132815 = takeFee(paymentAmountRaw, inFee)
752- let paymentAmount = $t03275132815._1
753- let feeAmount = $t03275132815._2
739+ let $t03259632660 = takeFee(paymentAmountRaw, inFee)
740+ let paymentAmount = $t03259632660._1
741+ let feeAmount = $t03259632660._2
754742 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
755743 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
756744 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
757745 let priceNew = fromX18(priceNewX18, scale8)
758746 let paymentBalance = if (paymentInAmountAsset)
759747 then amountBalanceOld
760748 else priceBalanceOld
761749 let paymentBalanceBigInt = toBigInt(paymentBalance)
762750 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
763751 let chechSupply = if ((supplyBigInt > big0))
764752 then true
765753 else throwErr("initial deposit requires all coins")
766754 if ((chechSupply == chechSupply))
767755 then {
768756 let depositBigInt = toBigInt(paymentAmount)
769757 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
770758 let commonState = if (isEval)
771759 then nil
772760 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))]
773761 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
774762 let priceOld = fromX18(priceOldX18, scale8)
775763 let loss = {
776- let $t03449634663 = if (paymentInAmountAsset)
764+ let $t03434134508 = if (paymentInAmountAsset)
777765 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
778766 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
779- let amount = $t03449634663._1
780- let balance = $t03449634663._2
767+ let amount = $t03434134508._1
768+ let balance = $t03434134508._2
781769 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
782770 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
783771 }
784772 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
785773 }
786774 else throw("Strict value is not equal to itself.")
787775 }
788776
789777
790778 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
791779 let isEval = (txId == unit)
792780 let cfg = getPoolConfig()
793781 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
794782 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
795783 let checks = [if ((paymentAssetId == cfgLpAssetId))
796784 then true
797785 else throwErr("invalid lp asset")]
798786 if ((checks == checks))
799787 then {
800788 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
801789 then true
802790 else if ((outAssetId == cfgPriceAssetId))
803791 then false
804792 else throwErr("invalid asset")
805793 let balanceBigInt = if (outInAmountAsset)
806794 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
807795 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
808796 let outInAmountAssetDecimals = if (outInAmountAsset)
809797 then amtAssetDcm
810798 else priceAssetDcm
811799 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
812800 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
813801 let outBalance = if (outInAmountAsset)
814802 then amBalanceOld
815803 else prBalanceOld
816804 let outBalanceBigInt = toBigInt(outBalance)
817805 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
818806 let redeemedBigInt = toBigInt(paymentAmount)
819807 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
820- let $t03674136797 = takeFee(amountRaw, outFee)
821- let totalAmount = $t03674136797._1
822- let feeAmount = $t03674136797._2
823- let $t03680137027 = if (outInAmountAsset)
808+ let $t03658636642 = takeFee(amountRaw, outFee)
809+ let totalAmount = $t03658636642._1
810+ let feeAmount = $t03658636642._2
811+ let $t03664636872 = if (outInAmountAsset)
824812 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
825813 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
826- let outAmAmount = $t03680137027._1
827- let outPrAmount = $t03680137027._2
828- let amBalanceNew = $t03680137027._3
829- let prBalanceNew = $t03680137027._4
814+ let outAmAmount = $t03664636872._1
815+ let outPrAmount = $t03664636872._2
816+ let amBalanceNew = $t03664636872._3
817+ let prBalanceNew = $t03664636872._4
830818 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
831819 let priceNew = fromX18(priceNewX18, scale8)
832820 let commonState = if (isEval)
833821 then nil
834822 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)]
835823 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
836824 let priceOld = fromX18(priceOldX18, scale8)
837825 let loss = {
838826 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
839827 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
840828 }
841829 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
842830 }
843831 else throw("Strict value is not equal to itself.")
844832 }
845833
846834
847835 func managerPublicKeyOrUnit () = match getString(mpk()) {
848836 case s: String =>
849837 fromBase58String(s)
850838 case _: Unit =>
851839 unit
852840 case _ =>
853841 throw("Match error")
854842 }
855843
856844
857845 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
858846 case s: String =>
859847 fromBase58String(s)
860848 case _: Unit =>
861849 unit
862850 case _ =>
863851 throw("Match error")
864852 }
865853
866854
867855 func isManager (i) = match managerPublicKeyOrUnit() {
868856 case pk: ByteVector =>
869857 (i.callerPublicKey == pk)
870858 case _: Unit =>
871859 (i.caller == this)
872860 case _ =>
873861 throw("Match error")
874862 }
875863
876864
877865 func mustManager (i) = {
878866 let pd = throw("Permission denied")
879867 match managerPublicKeyOrUnit() {
880868 case pk: ByteVector =>
881869 if ((i.callerPublicKey == pk))
882870 then true
883871 else pd
884872 case _: Unit =>
885873 if ((i.caller == this))
886874 then true
887875 else pd
888876 case _ =>
889877 throw("Match error")
890878 }
891879 }
892880
893881
894882 @Callable(i)
895883 func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa())))
896884
897885
898886
899887 @Callable(i)
900888 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
901- let $t03891339218 = if ((isReverse == false))
889+ let $t03875839063 = if ((isReverse == false))
902890 then {
903891 let assetOut = getStringOrFail(this, pa())
904892 let assetIn = getStringOrFail(this, aa())
905893 $Tuple2(assetOut, assetIn)
906894 }
907895 else {
908896 let assetOut = getStringOrFail(this, aa())
909897 let assetIn = getStringOrFail(this, pa())
910898 $Tuple2(assetOut, assetIn)
911899 }
912- let assetOut = $t03891339218._1
913- let assetIn = $t03891339218._2
900+ let assetOut = $t03875839063._1
901+ let assetIn = $t03875839063._2
914902 let poolAssetInBalance = getAccBalance(assetIn)
915903 let poolAssetOutBalance = getAccBalance(assetOut)
916904 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
917905 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
918906 let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
919907 let checkK = if ((newK >= oldK))
920908 then true
921909 else throw("new K is fewer error")
922910 if ((checkK == checkK))
923911 then $Tuple2(nil, amountOut)
924912 else throw("Strict value is not equal to itself.")
925913 }
926914
927915
928916
929917 @Callable(i)
930918 func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = {
931919 let swapContact = {
932920 let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil)
933921 if ($isInstanceOf(@, "String"))
934922 then @
935923 else throw(($getType(@) + " couldn't be cast to String"))
936924 }
937925 let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
938926 then true
939927 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
940928 then true
941929 else throwErr("Permission denied")]
942930 if ((checks == checks))
943931 then {
944932 let pmt = value(i.payments[0])
945933 let assetIn = assetIdToString(pmt.assetId)
946934 let assetOut = if ((isReverse == false))
947935 then getStringOrFail(this, pa())
948936 else getStringOrFail(this, aa())
949937 let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount)
950938 let poolAssetOutBalance = getAccBalance(assetOut)
951939 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
952940 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
953941 let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
954942 let checkK = if ((newK >= oldK))
955943 then true
956944 else throw("new K is fewer error")
957945 if ((checkK == checkK))
958946 then {
959947 let checkMin = if ((amountOut >= amountOutMin))
960948 then true
961949 else throw("Exchange result is fewer coins than expected")
962950 if ((checkMin == checkMin))
963951 then {
964952 let rebalanceState = rebalanceAsset(assetIn)
965953 if ((rebalanceState == rebalanceState))
966954 then {
967955 let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
968956 if ((withdrawState == withdrawState))
969957 then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
970958 else throw("Strict value is not equal to itself.")
971959 }
972960 else throw("Strict value is not equal to itself.")
973961 }
974962 else throw("Strict value is not equal to itself.")
975963 }
976964 else throw("Strict value is not equal to itself.")
977965 }
978966 else throw("Strict value is not equal to itself.")
979967 }
980968
981969
982970
983971 @Callable(i)
984972 func setManager (pendingManagerPublicKey) = {
985973 let checkCaller = mustManager(i)
986974 if ((checkCaller == checkCaller))
987975 then {
988976 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
989977 if ((checkManagerPublicKey == checkManagerPublicKey))
990978 then [StringEntry(pmpk(), pendingManagerPublicKey)]
991979 else throw("Strict value is not equal to itself.")
992980 }
993981 else throw("Strict value is not equal to itself.")
994982 }
995983
996984
997985
998986 @Callable(i)
999987 func confirmManager () = {
1000988 let pm = pendingManagerPublicKeyOrUnit()
1001989 let hasPM = if (isDefined(pm))
1002990 then true
1003991 else throw("No pending manager")
1004992 if ((hasPM == hasPM))
1005993 then {
1006994 let checkPM = if ((i.callerPublicKey == value(pm)))
1007995 then true
1008996 else throw("You are not pending manager")
1009997 if ((checkPM == checkPM))
1010998 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
1011999 else throw("Strict value is not equal to itself.")
10121000 }
10131001 else throw("Strict value is not equal to itself.")
10141002 }
10151003
10161004
10171005
10181006 @Callable(i)
10191007 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
10201008 then throw("Invalid slippageTolerance passed")
10211009 else {
10221010 let estPut = commonPut(i, slippageTolerance, true)
10231011 let emitLpAmt = estPut._2
10241012 let lpAssetId = estPut._7
10251013 let state = estPut._9
10261014 let amDiff = estPut._10
10271015 let prDiff = estPut._11
10281016 let amId = estPut._12
10291017 let prId = estPut._13
10301018 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10311019 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10321020 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10331021 if ((currentKLp == currentKLp))
10341022 then {
10351023 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
10361024 if ((emitInv == emitInv))
10371025 then {
10381026 let emitInvLegacy = match emitInv {
10391027 case legacyFactoryContract: Address =>
10401028 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
10411029 case _ =>
10421030 unit
10431031 }
10441032 if ((emitInvLegacy == emitInvLegacy))
10451033 then {
10461034 let slippageAInv = if ((amDiff > 0))
10471035 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
10481036 else nil
10491037 if ((slippageAInv == slippageAInv))
10501038 then {
10511039 let slippagePInv = if ((prDiff > 0))
10521040 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
10531041 else nil
10541042 if ((slippagePInv == slippagePInv))
10551043 then {
10561044 let lpTransfer = if (shouldAutoStake)
10571045 then {
10581046 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
10591047 if ((slpStakeInv == slpStakeInv))
10601048 then nil
10611049 else throw("Strict value is not equal to itself.")
10621050 }
10631051 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1064- let $t04426444726 = refreshKLpInternal(0, 0, 0)
1065- if (($t04426444726 == $t04426444726))
1052+ let $t04410944571 = refreshKLpInternal(0, 0, 0)
1053+ if (($t04410944571 == $t04410944571))
10661054 then {
1067- let updatedKLp = $t04426444726._2
1068- let refreshKLpActions = $t04426444726._1
1055+ let updatedKLp = $t04410944571._2
1056+ let refreshKLpActions = $t04410944571._1
10691057 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10701058 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10711059 then {
10721060 let reb = invoke(this, "rebalance", nil, nil)
10731061 if ((reb == reb))
10741062 then ((state ++ lpTransfer) ++ refreshKLpActions)
10751063 else throw("Strict value is not equal to itself.")
10761064 }
10771065 else throw("Strict value is not equal to itself.")
10781066 }
10791067 else throw("Strict value is not equal to itself.")
10801068 }
10811069 else throw("Strict value is not equal to itself.")
10821070 }
10831071 else throw("Strict value is not equal to itself.")
10841072 }
10851073 else throw("Strict value is not equal to itself.")
10861074 }
10871075 else throw("Strict value is not equal to itself.")
10881076 }
10891077 else throw("Strict value is not equal to itself.")
10901078 }
10911079
10921080
10931081
10941082 @Callable(i)
10951083 func putForFree (maxSlippage) = if ((0 > maxSlippage))
10961084 then throw("Invalid value passed")
10971085 else {
10981086 let estPut = commonPut(i, maxSlippage, false)
10991087 let state = estPut._9
11001088 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
11011089 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
11021090 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
11031091 if ((currentKLp == currentKLp))
11041092 then {
1105- let $t04533845403 = refreshKLpInternal(0, 0, 0)
1106- let refreshKLpActions = $t04533845403._1
1107- let updatedKLp = $t04533845403._2
1093+ let $t04518345248 = refreshKLpInternal(0, 0, 0)
1094+ let refreshKLpActions = $t04518345248._1
1095+ let updatedKLp = $t04518345248._2
11081096 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11091097 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11101098 then (state ++ refreshKLpActions)
11111099 else throw("Strict value is not equal to itself.")
11121100 }
11131101 else throw("Strict value is not equal to itself.")
11141102 }
11151103
11161104
11171105
11181106 @Callable(i)
11191107 func putOneTkn (minOutAmount,autoStake) = {
11201108 let isPoolOneTokenOperationsDisabled = {
11211109 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11221110 if ($isInstanceOf(@, "Boolean"))
11231111 then @
11241112 else throw(($getType(@) + " couldn't be cast to Boolean"))
11251113 }
11261114 let isPutDisabled = if (if (if (isGlobalShutdown())
11271115 then true
11281116 else (cfgPoolStatus == PoolPutDisabled))
11291117 then true
11301118 else (cfgPoolStatus == PoolShutdown))
11311119 then true
11321120 else isPoolOneTokenOperationsDisabled
11331121 let checks = [if (if (!(isPutDisabled))
11341122 then true
11351123 else isManager(i))
11361124 then true
11371125 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
11381126 then true
11391127 else throwErr("exactly 1 payment are expected")]
11401128 if ((checks == checks))
11411129 then {
11421130 let payment = i.payments[0]
11431131 let paymentAssetId = payment.assetId
11441132 let paymentAmountRaw = payment.amount
11451133 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
11461134 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
11471135 else if ((paymentAssetId == cfgPriceAssetId))
11481136 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
11491137 else throwErr("payment asset is not supported")
11501138 if ((currentKLp == currentKLp))
11511139 then {
11521140 let userAddress = i.caller
11531141 let txId = i.transactionId
1154- let $t04659146743 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1155- if (($t04659146743 == $t04659146743))
1142+ let $t04643646588 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1143+ if (($t04643646588 == $t04643646588))
11561144 then {
1157- let paymentInAmountAsset = $t04659146743._5
1158- let bonus = $t04659146743._4
1159- let feeAmount = $t04659146743._3
1160- let commonState = $t04659146743._2
1161- let emitAmountEstimated = $t04659146743._1
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
11621150 let emitAmount = if (if ((minOutAmount > 0))
11631151 then (minOutAmount > emitAmountEstimated)
11641152 else false)
11651153 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
11661154 else emitAmountEstimated
11671155 let emitInv = emit(emitAmount)
11681156 if ((emitInv == emitInv))
11691157 then {
11701158 let lpTransfer = if (autoStake)
11711159 then {
11721160 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
11731161 if ((stakeInv == stakeInv))
11741162 then nil
11751163 else throw("Strict value is not equal to itself.")
11761164 }
11771165 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
11781166 let sendFee = if ((feeAmount > 0))
11791167 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11801168 else nil
1181- let $t04732947526 = if ((this == feeCollectorAddress))
1169+ let $t04717447371 = if ((this == feeCollectorAddress))
11821170 then $Tuple2(0, 0)
11831171 else if (paymentInAmountAsset)
11841172 then $Tuple2(-(feeAmount), 0)
11851173 else $Tuple2(0, -(feeAmount))
1186- let amountAssetBalanceDelta = $t04732947526._1
1187- let priceAssetBalanceDelta = $t04732947526._2
1188- let $t04752947637 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1189- let refreshKLpActions = $t04752947637._1
1190- let updatedKLp = $t04752947637._2
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
11911179 let kLp = value(getString(keyKLp))
11921180 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11931181 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11941182 then {
11951183 let reb = invoke(this, "rebalance", nil, nil)
11961184 if ((reb == reb))
11971185 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
11981186 else throw("Strict value is not equal to itself.")
11991187 }
12001188 else throw("Strict value is not equal to itself.")
12011189 }
12021190 else throw("Strict value is not equal to itself.")
12031191 }
12041192 else throw("Strict value is not equal to itself.")
12051193 }
12061194 else throw("Strict value is not equal to itself.")
12071195 }
12081196 else throw("Strict value is not equal to itself.")
12091197 }
12101198
12111199
12121200
12131201 @Callable(i)
12141202 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1215- let $t04799248149 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1216- let emitAmountEstimated = $t04799248149._1
1217- let commonState = $t04799248149._2
1218- let feeAmount = $t04799248149._3
1219- let bonus = $t04799248149._4
1220- let paymentInAmountAsset = $t04799248149._5
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
12211209 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12221210 }
12231211
12241212
12251213
12261214 @Callable(i)
12271215 func getOneTkn (outAssetIdStr,minOutAmount) = {
12281216 let isPoolOneTokenOperationsDisabled = {
12291217 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12301218 if ($isInstanceOf(@, "Boolean"))
12311219 then @
12321220 else throw(($getType(@) + " couldn't be cast to Boolean"))
12331221 }
12341222 let isGetDisabled = if (if (isGlobalShutdown())
12351223 then true
12361224 else (cfgPoolStatus == PoolShutdown))
12371225 then true
12381226 else isPoolOneTokenOperationsDisabled
12391227 let checks = [if (if (!(isGetDisabled))
12401228 then true
12411229 else isManager(i))
12421230 then true
12431231 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
12441232 then true
12451233 else throwErr("exactly 1 payment are expected")]
12461234 if ((checks == checks))
12471235 then {
12481236 let outAssetId = parseAssetId(outAssetIdStr)
12491237 let payment = i.payments[0]
12501238 let paymentAssetId = payment.assetId
12511239 let paymentAmount = payment.amount
12521240 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12531241 if ((currentKLp == currentKLp))
12541242 then {
12551243 let userAddress = i.caller
12561244 let txId = i.transactionId
1257- let $t04903449187 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1258- if (($t04903449187 == $t04903449187))
1245+ let $t04887949032 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1246+ if (($t04887949032 == $t04887949032))
12591247 then {
1260- let outInAmountAsset = $t04903449187._5
1261- let bonus = $t04903449187._4
1262- let feeAmount = $t04903449187._3
1263- let commonState = $t04903449187._2
1264- let amountEstimated = $t04903449187._1
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
12651253 let amount = if (if ((minOutAmount > 0))
12661254 then (minOutAmount > amountEstimated)
12671255 else false)
12681256 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
12691257 else amountEstimated
12701258 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
12711259 if ((burnInv == burnInv))
12721260 then {
12731261 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
12741262 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
12751263 let sendFee = if ((feeAmount > 0))
12761264 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12771265 else nil
1278- let $t04975850005 = {
1266+ let $t04960349850 = {
12791267 let feeAmountForCalc = if ((this == feeCollectorAddress))
12801268 then 0
12811269 else feeAmount
12821270 if (outInAmountAsset)
12831271 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12841272 else $Tuple2(0, -((amount + feeAmountForCalc)))
12851273 }
1286- let amountAssetBalanceDelta = $t04975850005._1
1287- let priceAssetBalanceDelta = $t04975850005._2
1288- let $t05000850116 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1289- let refreshKLpActions = $t05000850116._1
1290- let updatedKLp = $t05000850116._2
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
12911279 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12921280 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12931281 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
12941282 else throw("Strict value is not equal to itself.")
12951283 }
12961284 else throw("Strict value is not equal to itself.")
12971285 }
12981286 else throw("Strict value is not equal to itself.")
12991287 }
13001288 else throw("Strict value is not equal to itself.")
13011289 }
13021290 else throw("Strict value is not equal to itself.")
13031291 }
13041292
13051293
13061294
13071295 @Callable(i)
13081296 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1309- let $t05039450550 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1310- let amountEstimated = $t05039450550._1
1311- let commonState = $t05039450550._2
1312- let feeAmount = $t05039450550._3
1313- let bonus = $t05039450550._4
1314- let outInAmountAsset = $t05039450550._5
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
13151303 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13161304 }
13171305
13181306
13191307
13201308 @Callable(i)
13211309 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
13221310 let isPoolOneTokenOperationsDisabled = {
13231311 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13241312 if ($isInstanceOf(@, "Boolean"))
13251313 then @
13261314 else throw(($getType(@) + " couldn't be cast to Boolean"))
13271315 }
13281316 let isGetDisabled = if (if (isGlobalShutdown())
13291317 then true
13301318 else (cfgPoolStatus == PoolShutdown))
13311319 then true
13321320 else isPoolOneTokenOperationsDisabled
13331321 let checks = [if (if (!(isGetDisabled))
13341322 then true
13351323 else isManager(i))
13361324 then true
13371325 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13381326 then true
13391327 else throwErr("no payments are expected")]
13401328 if ((checks == checks))
13411329 then {
13421330 let outAssetId = parseAssetId(outAssetIdStr)
13431331 let userAddress = i.caller
13441332 let txId = i.transactionId
13451333 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13461334 if ((currentKLp == currentKLp))
13471335 then {
13481336 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13491337 if ((unstakeInv == unstakeInv))
13501338 then {
1351- let $t05145551606 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1352- if (($t05145551606 == $t05145551606))
1339+ let $t05130051451 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1340+ if (($t05130051451 == $t05130051451))
13531341 then {
1354- let outInAmountAsset = $t05145551606._5
1355- let bonus = $t05145551606._4
1356- let feeAmount = $t05145551606._3
1357- let commonState = $t05145551606._2
1358- let amountEstimated = $t05145551606._1
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
13591347 let amount = if (if ((minOutAmount > 0))
13601348 then (minOutAmount > amountEstimated)
13611349 else false)
13621350 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
13631351 else amountEstimated
13641352 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13651353 if ((burnInv == burnInv))
13661354 then {
13671355 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, amount)
13681356 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
13691357 let sendFee = if ((feeAmount > 0))
13701358 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13711359 else nil
1372- let $t05217252419 = {
1360+ let $t05201752264 = {
13731361 let feeAmountForCalc = if ((this == feeCollectorAddress))
13741362 then 0
13751363 else feeAmount
13761364 if (outInAmountAsset)
13771365 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13781366 else $Tuple2(0, -((amount + feeAmountForCalc)))
13791367 }
1380- let amountAssetBalanceDelta = $t05217252419._1
1381- let priceAssetBalanceDelta = $t05217252419._2
1382- let $t05242252530 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1383- let refreshKLpActions = $t05242252530._1
1384- let updatedKLp = $t05242252530._2
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
13851373 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13861374 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13871375 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13881376 else throw("Strict value is not equal to itself.")
13891377 }
13901378 else throw("Strict value is not equal to itself.")
13911379 }
13921380 else throw("Strict value is not equal to itself.")
13931381 }
13941382 else throw("Strict value is not equal to itself.")
13951383 }
13961384 else throw("Strict value is not equal to itself.")
13971385 }
13981386 else throw("Strict value is not equal to itself.")
13991387 }
14001388
14011389
14021390
14031391 @Callable(i)
14041392 func get () = {
14051393 let res = commonGet(i)
14061394 let outAmAmt = res._1
14071395 let outPrAmt = res._2
14081396 let pmtAmt = res._3
14091397 let pmtAssetId = res._4
14101398 let state = res._5
14111399 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14121400 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14131401 if ((currentKLp == currentKLp))
14141402 then {
14151403 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14161404 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14171405 then {
1418- let $t05362553706 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1419- let refreshKLpActions = $t05362553706._1
1420- let updatedKLp = $t05362553706._2
1406+ let $t05347053551 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1407+ let refreshKLpActions = $t05347053551._1
1408+ let updatedKLp = $t05347053551._2
14211409 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14221410 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14231411 then ((withdrawState ++ state) ++ refreshKLpActions)
14241412 else throw("Strict value is not equal to itself.")
14251413 }
14261414 else throw("Strict value is not equal to itself.")
14271415 }
14281416 else throw("Strict value is not equal to itself.")
14291417 }
14301418
14311419
14321420
14331421 @Callable(i)
14341422 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
14351423 let res = commonGet(i)
14361424 let outAmAmt = res._1
14371425 let outPrAmt = res._2
14381426 let pmtAmt = res._3
14391427 let pmtAssetId = res._4
14401428 let state = res._5
14411429 if ((noLessThenAmtAsset > outAmAmt))
14421430 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
14431431 else if ((noLessThenPriceAsset > outPrAmt))
14441432 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14451433 else {
14461434 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14471435 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14481436 if ((currentKLp == currentKLp))
14491437 then {
14501438 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14511439 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14521440 then {
1453- let $t05480154882 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1454- let refreshKLpActions = $t05480154882._1
1455- let updatedKLp = $t05480154882._2
1441+ let $t05464654727 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1442+ let refreshKLpActions = $t05464654727._1
1443+ let updatedKLp = $t05464654727._2
14561444 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14571445 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14581446 then ((withdrawState ++ state) ++ refreshKLpActions)
14591447 else throw("Strict value is not equal to itself.")
14601448 }
14611449 else throw("Strict value is not equal to itself.")
14621450 }
14631451 else throw("Strict value is not equal to itself.")
14641452 }
14651453 }
14661454
14671455
14681456
14691457 @Callable(i)
14701458 func unstakeAndGet (amount) = {
14711459 let checkPayments = if ((size(i.payments) != 0))
14721460 then throw("No payments are expected")
14731461 else true
14741462 if ((checkPayments == checkPayments))
14751463 then {
14761464 let cfg = getPoolConfig()
14771465 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
14781466 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14791467 if ((currentKLp == currentKLp))
14801468 then {
14811469 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
14821470 if ((unstakeInv == unstakeInv))
14831471 then {
14841472 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
14851473 let outAmAmt = res._1
14861474 let outPrAmt = res._2
14871475 let poolStatus = parseIntValue(res._9)
14881476 let state = res._10
14891477 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14901478 let checkPoolStatus = if (if (isGlobalShutdown())
14911479 then true
14921480 else (poolStatus == PoolShutdown))
14931481 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
14941482 else true
14951483 if ((checkPoolStatus == checkPoolStatus))
14961484 then {
14971485 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14981486 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14991487 then {
1500- let $t05615456235 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1501- let refreshKLpActions = $t05615456235._1
1502- let updatedKLp = $t05615456235._2
1488+ let $t05599956080 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1489+ let refreshKLpActions = $t05599956080._1
1490+ let updatedKLp = $t05599956080._2
15031491 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15041492 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15051493 then ((withdrawState ++ state) ++ refreshKLpActions)
15061494 else throw("Strict value is not equal to itself.")
15071495 }
15081496 else throw("Strict value is not equal to itself.")
15091497 }
15101498 else throw("Strict value is not equal to itself.")
15111499 }
15121500 else throw("Strict value is not equal to itself.")
15131501 }
15141502 else throw("Strict value is not equal to itself.")
15151503 }
15161504 else throw("Strict value is not equal to itself.")
15171505 }
15181506
15191507
15201508
15211509 @Callable(i)
15221510 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
15231511 let isGetDisabled = if (isGlobalShutdown())
15241512 then true
15251513 else (cfgPoolStatus == PoolShutdown)
15261514 let checks = [if (!(isGetDisabled))
15271515 then true
15281516 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15291517 then true
15301518 else throw("no payments are expected")]
15311519 if ((checks == checks))
15321520 then {
15331521 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15341522 if ((currentKLp == currentKLp))
15351523 then {
15361524 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
15371525 if ((unstakeInv == unstakeInv))
15381526 then {
15391527 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
15401528 let outAmAmt = res._1
15411529 let outPrAmt = res._2
15421530 let state = res._10
15431531 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
15441532 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15451533 then true
15461534 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15471535 then true
15481536 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
15491537 if ((checkAmounts == checkAmounts))
15501538 then {
15511539 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15521540 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15531541 then {
1554- let $t05767657757 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1555- let refreshKLpActions = $t05767657757._1
1556- let updatedKLp = $t05767657757._2
1542+ let $t05752157602 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1543+ let refreshKLpActions = $t05752157602._1
1544+ let updatedKLp = $t05752157602._2
15571545 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15581546 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15591547 then ((withdrawState ++ state) ++ refreshKLpActions)
15601548 else throw("Strict value is not equal to itself.")
15611549 }
15621550 else throw("Strict value is not equal to itself.")
15631551 }
15641552 else throw("Strict value is not equal to itself.")
15651553 }
15661554 else throw("Strict value is not equal to itself.")
15671555 }
15681556 else throw("Strict value is not equal to itself.")
15691557 }
15701558 else throw("Strict value is not equal to itself.")
15711559 }
15721560
15731561
15741562
15751563 @Callable(i)
15761564 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
15771565 then throw("permissions denied")
15781566 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
15791567
15801568
15811569
15821570 @Callable(i)
15831571 func refreshKLp () = {
15841572 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
15851573 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
15861574 then unit
15871575 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
15881576 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15891577 then {
15901578 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1591- let $t05896159025 = refreshKLpInternal(0, 0, 0)
1592- let kLpUpdateActions = $t05896159025._1
1593- let updatedKLp = $t05896159025._2
1579+ let $t05880658870 = refreshKLpInternal(0, 0, 0)
1580+ let kLpUpdateActions = $t05880658870._1
1581+ let updatedKLp = $t05880658870._2
15941582 let actions = if ((kLp != updatedKLp))
15951583 then kLpUpdateActions
15961584 else throwErr("nothing to refresh")
15971585 $Tuple2(actions, toString(updatedKLp))
15981586 }
15991587 else throw("Strict value is not equal to itself.")
16001588 }
16011589
16021590
16031591
16041592 @Callable(i)
16051593 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
16061594
16071595
16081596
16091597 @Callable(i)
16101598 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
16111599
16121600
16131601
16141602 @Callable(i)
16151603 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
16161604 let prices = calcPrices(amAmt, prAmt, lpAmt)
16171605 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
16181606 }
16191607
16201608
16211609
16221610 @Callable(i)
16231611 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
16241612
16251613
16261614
16271615 @Callable(i)
16281616 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
16291617
16301618
16311619
16321620 @Callable(i)
16331621 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
16341622
16351623
16361624
16371625 @Callable(i)
16381626 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
16391627
16401628
16411629
16421630 @Callable(i)
16431631 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
16441632 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
16451633 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
16461634 }
16471635
16481636
16491637
16501638 @Callable(i)
16511639 func statsREADONLY () = {
16521640 let cfg = getPoolConfig()
16531641 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16541642 let amtAssetId = cfg[idxAmtAssetId]
16551643 let priceAssetId = cfg[idxPriceAssetId]
16561644 let iAmtAssetId = cfg[idxIAmtAssetId]
16571645 let iPriceAssetId = cfg[idxIPriceAssetId]
16581646 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16591647 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16601648 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16611649 let accAmtAssetBalance = getAccBalance(amtAssetId)
16621650 let accPriceAssetBalance = getAccBalance(priceAssetId)
16631651 let pricesList = if ((poolLPBalance == 0))
16641652 then [zeroBigInt, zeroBigInt, zeroBigInt]
16651653 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
16661654 let curPrice = 0
16671655 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
16681656 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
16691657 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
16701658 $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))
16711659 }
16721660
16731661
16741662
16751663 @Callable(i)
16761664 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
16771665 let cfg = getPoolConfig()
16781666 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16791667 let amAssetIdStr = cfg[idxAmtAssetId]
16801668 let amAssetId = fromBase58String(amAssetIdStr)
16811669 let prAssetIdStr = cfg[idxPriceAssetId]
16821670 let prAssetId = fromBase58String(prAssetIdStr)
16831671 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16841672 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16851673 let poolStatus = cfg[idxPoolStatus]
16861674 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16871675 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
16881676 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
16891677 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
16901678 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
16911679 let curPriceX18 = if ((poolLPBalance == 0))
16921680 then zeroBigInt
16931681 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
16941682 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
16951683 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
16961684 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
16971685 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
16981686 let calcLpAmt = estPut._1
16991687 let curPriceCalc = estPut._3
17001688 let amBalance = estPut._4
17011689 let prBalance = estPut._5
17021690 let lpEmission = estPut._6
17031691 $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))
17041692 }
17051693
17061694
17071695
17081696 @Callable(i)
17091697 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
17101698 let cfg = getPoolConfig()
17111699 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
17121700 let amAssetIdStr = cfg[idxAmtAssetId]
17131701 let amAssetId = fromBase58String(amAssetIdStr)
17141702 let prAssetIdStr = cfg[idxPriceAssetId]
17151703 let prAssetId = fromBase58String(prAssetIdStr)
17161704 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
17171705 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17181706 let poolStatus = cfg[idxPoolStatus]
17191707 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17201708 let amBalanceRaw = getAccBalance(amAssetIdStr)
17211709 let prBalanceRaw = getAccBalance(prAssetIdStr)
17221710 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
17231711 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
17241712 let curPriceX18 = if ((poolLPBalance == 0))
17251713 then zeroBigInt
17261714 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
17271715 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
17281716 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
17291717 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
17301718 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17311719 let calcLpAmt = estPut._1
17321720 let curPriceCalc = estPut._3
17331721 let amBalance = estPut._4
17341722 let prBalance = estPut._5
17351723 let lpEmission = estPut._6
17361724 $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))
17371725 }
17381726
17391727
17401728
17411729 @Callable(i)
17421730 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
17431731 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
17441732 let outAmAmt = res._1
17451733 let outPrAmt = res._2
17461734 let amBalance = res._5
17471735 let prBalance = res._6
17481736 let lpEmission = res._7
17491737 let curPrice = res._8
17501738 let poolStatus = parseIntValue(res._9)
17511739 $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))
17521740 }
17531741
17541742
17551743 @Verifier(tx)
17561744 func verify () = {
17571745 let targetPublicKey = match managerPublicKeyOrUnit() {
17581746 case pk: ByteVector =>
17591747 pk
17601748 case _: Unit =>
17611749 tx.senderPublicKey
17621750 case _ =>
17631751 throw("Match error")
17641752 }
17651753 match tx {
17661754 case order: Order =>
17671755 let matcherPub = getMatcherPubOrFail()
1768- let $t06768767756 = validateMatcherOrderAllowed(order)
1769- let orderValid = $t06768767756._1
1770- let orderValidInfo = $t06768767756._2
1756+ let $t06753267601 = validateMatcherOrderAllowed(order)
1757+ let orderValid = $t06753267601._1
1758+ let orderValidInfo = $t06753267601._2
17711759 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17721760 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17731761 if (if (if (orderValid)
17741762 then senderValid
17751763 else false)
17761764 then matcherValid
17771765 else false)
17781766 then true
17791767 else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid)
17801768 case s: SetScriptTransaction =>
17811769 if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey))
17821770 then true
17831771 else {
17841772 let newHash = blake2b256(value(s.script))
17851773 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
17861774 let currentHash = scriptHash(this)
17871775 if ((allowedHash == newHash))
17881776 then (currentHash != newHash)
17891777 else false
17901778 }
17911779 case _ =>
17921780 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
17931781 }
17941782 }
17951783

github/deemru/w8io/169f3d6 
228.94 ms