tx · 5FSZxSCdLkSArqmugxZ7tpUjdkEChPNr3LRVEvRhF16U

3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh:  -0.04300000 Waves

2024.07.02 11:00 [3176107] smart account 3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh > SELF 0.00000000 Waves

{ "type": 13, "id": "5FSZxSCdLkSArqmugxZ7tpUjdkEChPNr3LRVEvRhF16U", "fee": 4300000, "feeAssetId": null, "timestamp": 1719907188307, "version": 2, "chainId": 84, "sender": "3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh", "senderPublicKey": "Cr8D7eozSzJh7XHsYTjBinPpo3SS83BrCGiBAJsjGxBo", "proofs": [ "5VPEy3p8pLtYFeHcLzy91yi6sKw3KRuuSNJJUHVixfre8YotpXYPq7o4FMKYycbtYdv1GurdMzaAj3Vq8xqDMefJ" ], "script": "base64:BgL8OAgCEgASBQoDAQQBEgcKBQEEAQgBEgQKAgEEEgMKAQESBAoCAQQSBAoCCAESBAoCCAESBAoCCAESBQoDAQgBEgASBAoCAQESAwoBARIFCgMBAQESBAoCCAgSABIAEgMKAQgSBQoDAQEBEgQKAgEBEgQKAggBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgASAwoBARIDCgEBEgQKAggBIgpsUGRlY2ltYWxzIgZzY2FsZTgiDHNjYWxlOEJpZ0ludCIHc2NhbGUxOCIKemVyb0JpZ0ludCIEYmlnMCIEYmlnMSIEYmlnMiILd2F2ZXNTdHJpbmciA1NFUCIKUG9vbEFjdGl2ZSIPUG9vbFB1dERpc2FibGVkIhNQb29sTWF0Y2hlckRpc2FibGVkIgxQb29sU2h1dGRvd24iDmlkeFBvb2xBZGRyZXNzIg1pZHhQb29sU3RhdHVzIhBpZHhQb29sTFBBc3NldElkIg1pZHhBbXRBc3NldElkIg9pZHhQcmljZUFzc2V0SWQiDmlkeEFtdEFzc2V0RGNtIhBpZHhQcmljZUFzc2V0RGNtIg5pZHhJQW10QXN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AAAUCaXHkYp+E", "height": 3176107, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4LvBbTHuCknjkoYQJmZscT6hxq18Y75AAXTz9io4Wktq Next: Dy6wBmiotb6XRhWz46Cz6TqDbAqfMXUfdPmmU1aL1CNK Diff:
OldNewDifferences
10021002 let assetOut = if ((isReverse == false))
10031003 then getStringOrFail(this, pa())
10041004 else getStringOrFail(this, aa())
1005- let poolAssetInBalance = ((getAccBalance(assetIn) - value(i.payments[0]).amount) - feePoolAmount)
1005+ let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount)
10061006 let poolAssetOutBalance = getAccBalance(assetOut)
10071007 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
10081008 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
1009- let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
1009+ let newK = (toBigInt(getAccBalance(assetIn)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
10101010 let checkK = if ((newK >= oldK))
10111011 then true
10121012 else throw("new K is fewer error")
10171017 else throw("Exchange result is fewer coins than expected")
10181018 if ((checkMin == checkMin))
10191019 then {
1020- let amountAssetBalanceDelta = if (isReverse)
1021- then -(amountOut)
1022- else feePoolAmount
1023- let priceAssetBalanceDelta = if (isReverse)
1024- then feePoolAmount
1025- else -(amountOut)
1026- let refreshKLpActions = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)._1
1027- if ((refreshKLpActions == refreshKLpActions))
1020+ let priceAssetId = getStringOrFail(this, pa())
1021+ let feeAssetId = fromBase58String(priceAssetId)
1022+ let feeAmount = fraction(cleanAmountIn, feePoolAmount, 100)
1023+ let rebalanceState = rebalanceAsset(assetIn)
1024+ if ((rebalanceState == rebalanceState))
10281025 then {
1029- let rebalanceState = rebalanceAsset(assetIn)
1030- if ((rebalanceState == rebalanceState))
1026+ let withdrawState = withdrawAndRebalanceAsset(assetOut, (amountOut + feeAmount))
1027+ if ((withdrawState == withdrawState))
10311028 then {
1032- let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
1033- if ((withdrawState == withdrawState))
1034- then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
1035- else throw("Strict value is not equal to itself.")
1029+ let feeTransfer = ScriptTransfer(feeCollectorAddress, feeAmount, feeAssetId)
1030+ $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), (amountOut - feeAmount), parseAssetId(assetOut)), feeTransfer]), amountOut)
10361031 }
10371032 else throw("Strict value is not equal to itself.")
10381033 }
10931088 else throw("Strict value is not equal to itself.")
10941089 }
10951090 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1096- let $t04564846110 = refreshKLpInternal(0, 0, 0)
1097- if (($t04564846110 == $t04564846110))
1091+ let $t04559246054 = refreshKLpInternal(0, 0, 0)
1092+ if (($t04559246054 == $t04559246054))
10981093 then {
1099- let updatedKLp = $t04564846110._2
1100- let refreshKLpActions = $t04564846110._1
1094+ let updatedKLp = $t04559246054._2
1095+ let refreshKLpActions = $t04559246054._1
11011096 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11021097 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11031098 then {
11341129 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
11351130 if ((currentKLp == currentKLp))
11361131 then {
1137- let $t04672246787 = refreshKLpInternal(0, 0, 0)
1138- let refreshKLpActions = $t04672246787._1
1139- let updatedKLp = $t04672246787._2
1132+ let $t04666646731 = refreshKLpInternal(0, 0, 0)
1133+ let refreshKLpActions = $t04666646731._1
1134+ let updatedKLp = $t04666646731._2
11401135 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11411136 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11421137 then (state ++ refreshKLpActions)
11851180 then {
11861181 let userAddress = i.caller
11871182 let txId = i.transactionId
1188- let $t04801648168 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1189- if (($t04801648168 == $t04801648168))
1183+ let $t04796048112 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1184+ if (($t04796048112 == $t04796048112))
11901185 then {
1191- let paymentInAmountAsset = $t04801648168._5
1192- let bonus = $t04801648168._4
1193- let feeAmount = $t04801648168._3
1194- let commonState = $t04801648168._2
1195- let emitAmountEstimated = $t04801648168._1
1186+ let paymentInAmountAsset = $t04796048112._5
1187+ let bonus = $t04796048112._4
1188+ let feeAmount = $t04796048112._3
1189+ let commonState = $t04796048112._2
1190+ let emitAmountEstimated = $t04796048112._1
11961191 let emitAmount = if (if ((minOutAmount > 0))
11971192 then (minOutAmount > emitAmountEstimated)
11981193 else false)
12121207 let sendFee = if ((feeAmount > 0))
12131208 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
12141209 else nil
1215- let $t04875448951 = if ((this == feeCollectorAddress))
1210+ let $t04869848895 = if ((this == feeCollectorAddress))
12161211 then $Tuple2(0, 0)
12171212 else if (paymentInAmountAsset)
12181213 then $Tuple2(-(feeAmount), 0)
12191214 else $Tuple2(0, -(feeAmount))
1220- let amountAssetBalanceDelta = $t04875448951._1
1221- let priceAssetBalanceDelta = $t04875448951._2
1222- let $t04895449062 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1223- let refreshKLpActions = $t04895449062._1
1224- let updatedKLp = $t04895449062._2
1215+ let amountAssetBalanceDelta = $t04869848895._1
1216+ let priceAssetBalanceDelta = $t04869848895._2
1217+ let $t04889849006 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1218+ let refreshKLpActions = $t04889849006._1
1219+ let updatedKLp = $t04889849006._2
12251220 let kLp = value(getString(keyKLp))
12261221 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12271222 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12461241
12471242 @Callable(i)
12481243 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1249- let $t04941749574 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1250- let emitAmountEstimated = $t04941749574._1
1251- let commonState = $t04941749574._2
1252- let feeAmount = $t04941749574._3
1253- let bonus = $t04941749574._4
1254- let paymentInAmountAsset = $t04941749574._5
1244+ let $t04936149518 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1245+ let emitAmountEstimated = $t04936149518._1
1246+ let commonState = $t04936149518._2
1247+ let feeAmount = $t04936149518._3
1248+ let bonus = $t04936149518._4
1249+ let paymentInAmountAsset = $t04936149518._5
12551250 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12561251 }
12571252
12901285 then {
12911286 let userAddress = i.caller
12921287 let txId = i.transactionId
1293- let $t05049650649 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1294- if (($t05049650649 == $t05049650649))
1288+ let $t05044050593 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1289+ if (($t05044050593 == $t05044050593))
12951290 then {
1296- let outInAmountAsset = $t05049650649._5
1297- let bonus = $t05049650649._4
1298- let feeAmount = $t05049650649._3
1299- let commonState = $t05049650649._2
1300- let amountEstimated = $t05049650649._1
1291+ let outInAmountAsset = $t05044050593._5
1292+ let bonus = $t05044050593._4
1293+ let feeAmount = $t05044050593._3
1294+ let commonState = $t05044050593._2
1295+ let amountEstimated = $t05044050593._1
13011296 let amount = if (if ((minOutAmount > 0))
13021297 then (minOutAmount > amountEstimated)
13031298 else false)
13111306 let sendFee = if ((feeAmount > 0))
13121307 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13131308 else nil
1314- let $t05131351560 = {
1309+ let $t05125751504 = {
13151310 let feeAmountForCalc = if ((this == feeCollectorAddress))
13161311 then 0
13171312 else feeAmount
13191314 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13201315 else $Tuple2(0, -((amount + feeAmountForCalc)))
13211316 }
1322- let amountAssetBalanceDelta = $t05131351560._1
1323- let priceAssetBalanceDelta = $t05131351560._2
1324- let $t05156351671 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1325- let refreshKLpActions = $t05156351671._1
1326- let updatedKLp = $t05156351671._2
1317+ let amountAssetBalanceDelta = $t05125751504._1
1318+ let priceAssetBalanceDelta = $t05125751504._2
1319+ let $t05150751615 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1320+ let refreshKLpActions = $t05150751615._1
1321+ let updatedKLp = $t05150751615._2
13271322 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13281323 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13291324 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13421337
13431338 @Callable(i)
13441339 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1345- let $t05194952105 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1346- let amountEstimated = $t05194952105._1
1347- let commonState = $t05194952105._2
1348- let feeAmount = $t05194952105._3
1349- let bonus = $t05194952105._4
1350- let outInAmountAsset = $t05194952105._5
1340+ let $t05189352049 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1341+ let amountEstimated = $t05189352049._1
1342+ let commonState = $t05189352049._2
1343+ let feeAmount = $t05189352049._3
1344+ let bonus = $t05189352049._4
1345+ let outInAmountAsset = $t05189352049._5
13511346 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13521347 }
13531348
13861381 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13871382 if ((unstakeInv == unstakeInv))
13881383 then {
1389- let $t05304753198 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1390- if (($t05304753198 == $t05304753198))
1384+ let $t05299153142 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1385+ if (($t05299153142 == $t05299153142))
13911386 then {
1392- let outInAmountAsset = $t05304753198._5
1393- let bonus = $t05304753198._4
1394- let feeAmount = $t05304753198._3
1395- let commonState = $t05304753198._2
1396- let amountEstimated = $t05304753198._1
1387+ let outInAmountAsset = $t05299153142._5
1388+ let bonus = $t05299153142._4
1389+ let feeAmount = $t05299153142._3
1390+ let commonState = $t05299153142._2
1391+ let amountEstimated = $t05299153142._1
13971392 let amount = if (if ((minOutAmount > 0))
13981393 then (minOutAmount > amountEstimated)
13991394 else false)
14071402 let sendFee = if ((feeAmount > 0))
14081403 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
14091404 else nil
1410- let $t05385754104 = {
1405+ let $t05380154048 = {
14111406 let feeAmountForCalc = if ((this == feeCollectorAddress))
14121407 then 0
14131408 else feeAmount
14151410 then $Tuple2(-((amount + feeAmountForCalc)), 0)
14161411 else $Tuple2(0, -((amount + feeAmountForCalc)))
14171412 }
1418- let amountAssetBalanceDelta = $t05385754104._1
1419- let priceAssetBalanceDelta = $t05385754104._2
1420- let $t05410754215 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1421- let refreshKLpActions = $t05410754215._1
1422- let updatedKLp = $t05410754215._2
1413+ let amountAssetBalanceDelta = $t05380154048._1
1414+ let priceAssetBalanceDelta = $t05380154048._2
1415+ let $t05405154159 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1416+ let refreshKLpActions = $t05405154159._1
1417+ let updatedKLp = $t05405154159._2
14231418 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14241419 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14251420 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
14531448 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14541449 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14551450 then {
1456- let $t05531055391 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1457- let refreshKLpActions = $t05531055391._1
1458- let updatedKLp = $t05531055391._2
1451+ let $t05525455335 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1452+ let refreshKLpActions = $t05525455335._1
1453+ let updatedKLp = $t05525455335._2
14591454 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14601455 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14611456 then ((withdrawState ++ state) ++ refreshKLpActions)
14881483 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14891484 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14901485 then {
1491- let $t05648656567 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1492- let refreshKLpActions = $t05648656567._1
1493- let updatedKLp = $t05648656567._2
1486+ let $t05643056511 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1487+ let refreshKLpActions = $t05643056511._1
1488+ let updatedKLp = $t05643056511._2
14941489 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14951490 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14961491 then ((withdrawState ++ state) ++ refreshKLpActions)
15381533 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
15391534 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15401535 then {
1541- let $t05791557996 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1542- let refreshKLpActions = $t05791557996._1
1543- let updatedKLp = $t05791557996._2
1536+ let $t05785957940 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1537+ let refreshKLpActions = $t05785957940._1
1538+ let updatedKLp = $t05785957940._2
15441539 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15451540 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15461541 then ((withdrawState ++ state) ++ refreshKLpActions)
15941589 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15951590 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15961591 then {
1597- let $t05947459555 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1598- let refreshKLpActions = $t05947459555._1
1599- let updatedKLp = $t05947459555._2
1592+ let $t05941859499 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1593+ let refreshKLpActions = $t05941859499._1
1594+ let updatedKLp = $t05941859499._2
16001595 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
16011596 if ((isUpdatedKLpValid == isUpdatedKLpValid))
16021597 then ((withdrawState ++ state) ++ refreshKLpActions)
16311626 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
16321627 then {
16331628 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1634- let $t06075960823 = refreshKLpInternal(0, 0, 0)
1635- let kLpUpdateActions = $t06075960823._1
1636- let updatedKLp = $t06075960823._2
1629+ let $t06070360767 = refreshKLpInternal(0, 0, 0)
1630+ let kLpUpdateActions = $t06070360767._1
1631+ let updatedKLp = $t06070360767._2
16371632 let actions = if ((kLp != updatedKLp))
16381633 then kLpUpdateActions
16391634 else throwErr("nothing to refresh")
18081803 match tx {
18091804 case order: Order =>
18101805 let matcherPub = getMatcherPubOrFail()
1811- let $t06948569602 = if (skipOrderValidation())
1806+ let $t06942969546 = if (skipOrderValidation())
18121807 then $Tuple2(true, "")
18131808 else validateMatcherOrderAllowed(order)
1814- let orderValid = $t06948569602._1
1815- let orderValidInfo = $t06948569602._2
1809+ let orderValid = $t06942969546._1
1810+ let orderValidInfo = $t06942969546._2
18161811 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
18171812 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
18181813 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 keyManagerPublicKey () = "%s__managerPublicKey"
9494
9595
9696 func keyManagerVaultAddress () = "%s__managerVaultAddress"
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 keySkipOrderValidation (poolAddress) = ("%s%s__skipOrderValidation__" + poolAddress)
172172
173173
174174 func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid)))
175175
176176
177177 func addressFromStringOrThis (addressString) = match addressFromString(addressString) {
178178 case a: Address =>
179179 a
180180 case _ =>
181181 this
182182 }
183183
184184
185185 func getManagerVaultAddressOrThis () = {
186186 let factoryAddress = match getString(fc()) {
187187 case fca: String =>
188188 addressFromStringOrThis(fca)
189189 case _ =>
190190 this
191191 }
192192 match getString(factoryAddress, keyManagerVaultAddress()) {
193193 case s: String =>
194194 addressFromStringOrThis(s)
195195 case _ =>
196196 this
197197 }
198198 }
199199
200200
201201 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
202202
203203
204204 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
205205
206206
207207 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
208208
209209
210210 func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
211211
212212
213213 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
214214
215215 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
216216
217217 let inFee = {
218218 let @ = invoke(factoryContract, "getInFeeREADONLY", [toString(this)], nil)
219219 if ($isInstanceOf(@, "Int"))
220220 then @
221221 else throw(($getType(@) + " couldn't be cast to Int"))
222222 }
223223
224224 let outFee = {
225225 let @ = invoke(factoryContract, "getOutFeeREADONLY", [toString(this)], nil)
226226 if ($isInstanceOf(@, "Int"))
227227 then @
228228 else throw(($getType(@) + " couldn't be cast to Int"))
229229 }
230230
231231 func keyAddressWhitelisted (address) = makeString(["%s%s", "whitelisted", toString(address)], SEP)
232232
233233
234234 func isAddressWhitelisted (address) = valueOrElse(getBoolean(factoryContract, keyAddressWhitelisted(address)), false)
235235
236236
237237 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
238238
239239
240240 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
241241
242242
243243 func getPoolConfig () = {
244244 let amtAsset = getStringOrFail(this, aa())
245245 let priceAsset = getStringOrFail(this, pa())
246246 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
247247 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
248248 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
249249 }
250250
251251
252252 func parseAssetId (input) = if ((input == wavesString))
253253 then unit
254254 else fromBase58String(input)
255255
256256
257257 func assetIdToString (input) = if ((input == unit))
258258 then wavesString
259259 else toBase58String(value(input))
260260
261261
262262 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]))
263263
264264
265265 let poolConfigParsed = parsePoolConfig(getPoolConfig())
266266
267267 let $t097699935 = poolConfigParsed
268268
269269 let cfgPoolAddress = $t097699935._1
270270
271271 let cfgPoolStatus = $t097699935._2
272272
273273 let cfgLpAssetId = $t097699935._3
274274
275275 let cfgAmountAssetId = $t097699935._4
276276
277277 let cfgPriceAssetId = $t097699935._5
278278
279279 let cfgAmountAssetDecimals = $t097699935._6
280280
281281 let cfgPriceAssetDecimals = $t097699935._7
282282
283283 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
284284
285285
286286 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
287287
288288 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
289289
290290 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)
291291
292292
293293 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)
294294
295295
296296 func getAccBalance (assetId) = {
297297 let balanceOnPool = if ((assetId == "WAVES"))
298298 then wavesBalance(this).available
299299 else assetBalance(this, fromBase58String(assetId))
300300 let totalBalance = ((balanceOnPool + getAdditionalBalanceOrZero(assetId)) - getStakingAssetBalanceOrZero(assetId))
301301 max([0, totalBalance])
302302 }
303303
304304
305305 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
306306
307307
308308 func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
309309
310310
311311 func getRate (proxy) = {
312312 let inv = invoke(proxy, "getRate", nil, nil)
313313 if ((inv == inv))
314314 then match inv {
315315 case r: Int =>
316316 r
317317 case _ =>
318318 throwErr("proxy.getRate() unexpected value")
319319 }
320320 else throw("Strict value is not equal to itself.")
321321 }
322322
323323
324324 func deposit (assetId,amount,stakingAssetId,proxy) = {
325325 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
326326 if ((currentAdditionalBalance == currentAdditionalBalance))
327327 then {
328328 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
329329 if ((currentStakingAssetBalance == currentStakingAssetBalance))
330330 then {
331331 let asset = parseAssetId(assetId)
332332 if ((amount > 0))
333333 then {
334334 let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)])
335335 if ((depositInvoke == depositInvoke))
336336 then match depositInvoke {
337337 case receivedStakingAsset: Int =>
338338 let newAdditionalBalance = (currentAdditionalBalance + amount)
339339 let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
340340 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
341341 case _ =>
342342 nil
343343 }
344344 else throw("Strict value is not equal to itself.")
345345 }
346346 else nil
347347 }
348348 else throw("Strict value is not equal to itself.")
349349 }
350350 else throw("Strict value is not equal to itself.")
351351 }
352352
353353
354354 func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = {
355355 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
356356 if ((currentAdditionalBalance == currentAdditionalBalance))
357357 then {
358358 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
359359 if ((currentStakingAssetBalance == currentStakingAssetBalance))
360360 then {
361361 let currentProxyRate = getRate(proxy)
362362 if ((currentProxyRate == currentProxyRate))
363363 then {
364364 let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance)
365365 let stakingAsset = parseAssetId(stakingAssetId)
366366 let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate)
367367 let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
368368 let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)])
369369 if ((sendStakingAssetAmount > 0))
370370 then {
371371 let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
372372 if ((withdrawInvoke == withdrawInvoke))
373373 then match withdrawInvoke {
374374 case receivedAssets: Int =>
375375 let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
376376 let newStakingAssetBalance = ((currentStakingAssetBalance - sendStakingAssetAmount) - profitAmount)
377377 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(stakingAssetId))]
378378 case _ =>
379379 nil
380380 }
381381 else throw("Strict value is not equal to itself.")
382382 }
383383 else nil
384384 }
385385 else throw("Strict value is not equal to itself.")
386386 }
387387 else throw("Strict value is not equal to itself.")
388388 }
389389 else throw("Strict value is not equal to itself.")
390390 }
391391
392392
393393 func getLeaseProxyConfig (assetId) = match invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil) {
394394 case a: (Boolean, Int, Int, String, String, Int, String) =>
395395 a
396396 case _ =>
397397 throwErr((("[" + assetId) + "] getLeaseProxyConfig() error"))
398398 }
399399
400400
401401 func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
402402 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
403403 if ((currentStakingAssetBalance == currentStakingAssetBalance))
404404 then {
405405 let currentAdditionalBalance = if ((currentStakingAssetBalance != 0))
406406 then getAdditionalBalanceOrZero(assetId)
407407 else 0
408408 if ((currentAdditionalBalance == currentAdditionalBalance))
409409 then {
410410 let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)])
411411 let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100)
412412 let diff = (currentAdditionalBalance - targetAdditionalBalance)
413413 if ((diff == 0))
414414 then nil
415415 else if ((0 > diff))
416416 then {
417417 let sendAssetAmount = -(diff)
418418 deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
419419 }
420420 else {
421421 let getAssetAmount = diff
422422 withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
423423 }
424424 }
425425 else throw("Strict value is not equal to itself.")
426426 }
427427 else throw("Strict value is not equal to itself.")
428428 }
429429
430430
431431 func rebalanceAsset (assetId) = {
432432 let $t01622016356 = getLeaseProxyConfig(assetId)
433433 let isLeasable = $t01622016356._1
434434 let leasedRatio = $t01622016356._2
435435 let minBalance = $t01622016356._3
436436 let proxyAddress = $t01622016356._4
437437 let proxyAssetId = $t01622016356._5
438438 let proxyRateMul = $t01622016356._6
439439 let stakingProfitAddress = $t01622016356._7
440440 if (isLeasable)
441441 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
442442 else nil
443443 }
444444
445445
446446 func withdrawAndRebalanceAsset (assetId,getAmount) = {
447447 let $t01675516891 = getLeaseProxyConfig(assetId)
448448 let isLeasable = $t01675516891._1
449449 let leasedRatio = $t01675516891._2
450450 let minBalance = $t01675516891._3
451451 let proxyAddress = $t01675516891._4
452452 let proxyAssetId = $t01675516891._5
453453 let proxyRateMul = $t01675516891._6
454454 let stakingProfitAddress = $t01675516891._7
455455 if (isLeasable)
456456 then {
457457 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(proxyAssetId)
458458 if ((currentStakingAssetBalance == currentStakingAssetBalance))
459459 then {
460460 let currentAdditionalBalance = if ((currentStakingAssetBalance != 0))
461461 then getAdditionalBalanceOrZero(assetId)
462462 else 0
463463 if ((currentAdditionalBalance == currentAdditionalBalance))
464464 then {
465465 let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
466466 if ((newTotalLeasableBalance == newTotalLeasableBalance))
467467 then {
468468 let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
469469 if ((newAdditionalBalance == newAdditionalBalance))
470470 then {
471471 let withdrawAmount = (currentAdditionalBalance - newAdditionalBalance)
472472 if ((withdrawAmount == withdrawAmount))
473473 then if ((withdrawAmount == 0))
474474 then nil
475475 else if ((0 > withdrawAmount))
476476 then deposit(assetId, -(withdrawAmount), proxyAssetId, addressFromStringValue(proxyAddress))
477477 else withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
478478 else throw("Strict value is not equal to itself.")
479479 }
480480 else throw("Strict value is not equal to itself.")
481481 }
482482 else throw("Strict value is not equal to itself.")
483483 }
484484 else throw("Strict value is not equal to itself.")
485485 }
486486 else throw("Strict value is not equal to itself.")
487487 }
488488 else nil
489489 }
490490
491491
492492 func withdrawAndRebalanceAll (amountAssetOutAmount,priceAssetOutAmount) = {
493493 let AmAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, aa()), amountAssetOutAmount)
494494 let PrAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, pa()), priceAssetOutAmount)
495495 (AmAmtWithdrawState ++ PrAmtWithdrawState)
496496 }
497497
498498
499499 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
500500 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
501501 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
502502 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
503503 }
504504
505505
506506 func calcPrices (amAmt,prAmt,lpAmt) = {
507507 let cfg = getPoolConfig()
508508 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
509509 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
510510 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
511511 let amAmtX18 = toX18(amAmt, amtAssetDcm)
512512 let prAmtX18 = toX18(prAmt, priceAssetDcm)
513513 let lpAmtX18 = toX18(lpAmt, scale8)
514514 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
515515 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
516516 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
517517 }
518518
519519
520520 func calculatePrices (amAmt,prAmt,lpAmt) = {
521521 let prices = calcPrices(amAmt, prAmt, lpAmt)
522522 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
523523 }
524524
525525
526526 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
527527 let cfg = getPoolConfig()
528528 let lpAssetId = cfg[idxPoolLPAssetId]
529529 let amAssetId = cfg[idxAmtAssetId]
530530 let prAssetId = cfg[idxPriceAssetId]
531531 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
532532 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
533533 let poolStatus = cfg[idxPoolStatus]
534534 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
535535 if ((lpAssetId != pmtAssetId))
536536 then throw("Invalid asset passed.")
537537 else {
538538 let amBalance = getAccBalance(amAssetId)
539539 let amBalanceX18 = toX18(amBalance, amAssetDcm)
540540 let prBalance = getAccBalance(prAssetId)
541541 let prBalanceX18 = toX18(prBalance, prAssetDcm)
542542 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
543543 let curPrice = fromX18(curPriceX18, scale8)
544544 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
545545 let lpEmissionX18 = toX18(lpEmission, scale8)
546546 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
547547 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
548548 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
549549 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
550550 let state = if ((txId58 == ""))
551551 then nil
552552 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
553553 then unit
554554 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
555555 then unit
556556 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)]
557557 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
558558 }
559559 }
560560
561561
562562 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
563563 let cfg = getPoolConfig()
564564 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
565565 let amAssetIdStr = cfg[idxAmtAssetId]
566566 let prAssetIdStr = cfg[idxPriceAssetId]
567567 let iAmtAssetId = cfg[idxIAmtAssetId]
568568 let iPriceAssetId = cfg[idxIPriceAssetId]
569569 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
570570 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
571571 let poolStatus = cfg[idxPoolStatus]
572572 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
573573 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
574574 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
575575 if (if ((amAssetIdStr != inAmAssetIdStr))
576576 then true
577577 else (prAssetIdStr != inPrAssetIdStr))
578578 then throw("Invalid amt or price asset passed.")
579579 else {
580580 let amBalance = if (isEvaluate)
581581 then getAccBalance(amAssetIdStr)
582582 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
583583 let prBalance = if (isEvaluate)
584584 then getAccBalance(prAssetIdStr)
585585 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
586586 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
587587 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
588588 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
589589 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
590590 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
591591 let res = if ((lpEmission == 0))
592592 then {
593593 let curPriceX18 = zeroBigInt
594594 let slippageX18 = zeroBigInt
595595 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
596596 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
597597 }
598598 else {
599599 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
600600 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
601601 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
602602 if (if ((curPriceX18 != zeroBigInt))
603603 then (slippageX18 > slippageToleranceX18)
604604 else false)
605605 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
606606 else {
607607 let lpEmissionX18 = toX18(lpEmission, scale8)
608608 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
609609 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
610610 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
611611 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
612612 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
613613 let expAmtAssetAmtX18 = expectedAmts._1
614614 let expPriceAssetAmtX18 = expectedAmts._2
615615 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
616616 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
617617 }
618618 }
619619 let calcLpAmt = res._1
620620 let calcAmAssetPmt = res._2
621621 let calcPrAssetPmt = res._3
622622 let curPrice = fromX18(res._4, scale8)
623623 let slippageCalc = fromX18(res._5, scale8)
624624 if ((0 >= calcLpAmt))
625625 then throw("Invalid calculations. LP calculated is less than zero.")
626626 else {
627627 let emitLpAmt = if (!(emitLp))
628628 then 0
629629 else calcLpAmt
630630 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
631631 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
632632 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))]
633633 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
634634 }
635635 }
636636 }
637637
638638
639639 func calcKLp (amountBalance,priceBalance,lpEmission) = {
640640 let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals))
641641 let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))
642642 let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
643643 if ((lpEmission == big0))
644644 then big0
645645 else updatedKLp
646646 }
647647
648648
649649 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
650650 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
651651 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
652652 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
653653 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
654654 currentKLp
655655 }
656656
657657
658658 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
659659 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
660660 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
661661 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
662662 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
663663 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
664664 $Tuple2(actions, updatedKLp)
665665 }
666666
667667
668668 func skipOrderValidation () = valueOrElse(getBoolean(factoryContract, keySkipOrderValidation(toString(this))), false)
669669
670670
671671 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
672672 then true
673673 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
674674
675675
676676 func validateMatcherOrderAllowed (order) = {
677677 let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
678678 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
679679 let amountAssetAmount = order.amount
680680 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
681681 let $t02951729729 = if ((order.orderType == Buy))
682682 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
683683 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
684684 let amountAssetBalanceDelta = $t02951729729._1
685685 let priceAssetBalanceDelta = $t02951729729._2
686686 if (if (if (isGlobalShutdown())
687687 then true
688688 else (cfgPoolStatus == PoolMatcherDisabled))
689689 then true
690690 else (cfgPoolStatus == PoolShutdown))
691691 then throw("Exchange operations disabled")
692692 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
693693 then true
694694 else (order.assetPair.priceAsset != cfgPriceAssetId))
695695 then throw("Wrong order assets.")
696696 else {
697697 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
698698 let $t03016930269 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
699699 let unusedActions = $t03016930269._1
700700 let kLpNew = $t03016930269._2
701701 let isOrderValid = (kLpNew >= kLp)
702702 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
703703 $Tuple2(isOrderValid, info)
704704 }
705705 }
706706
707707
708708 func commonGet (i) = if ((size(i.payments) != 1))
709709 then throw("exactly 1 payment is expected")
710710 else {
711711 let pmt = value(i.payments[0])
712712 let pmtAssetId = value(pmt.assetId)
713713 let pmtAmt = pmt.amount
714714 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
715715 let outAmAmt = res._1
716716 let outPrAmt = res._2
717717 let state = res._10
718718 let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
719719 then if (isGlobalShutdown())
720720 then true
721721 else (cfgPoolStatus == PoolShutdown)
722722 else false
723723 if (isGetDisabled)
724724 then throw(("Get operation is blocked by admin. Status = " + toString(cfgPoolStatus)))
725725 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
726726 }
727727
728728
729729 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
730730 then throw("exactly 2 payments are expected")
731731 else {
732732 let amAssetPmt = value(i.payments[0])
733733 let prAssetPmt = value(i.payments[1])
734734 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
735735 let isPutDisabled = if (!(isAddressWhitelisted(i.caller)))
736736 then if (if (isGlobalShutdown())
737737 then true
738738 else (cfgPoolStatus == PoolPutDisabled))
739739 then true
740740 else (cfgPoolStatus == PoolShutdown)
741741 else false
742742 if (isPutDisabled)
743743 then throw(("Put operation is blocked by admin. Status = " + toString(cfgPoolStatus)))
744744 else estPut
745745 }
746746
747747
748748 func emit (amount) = {
749749 let emitInv = invoke(factoryContract, "emit", [amount], nil)
750750 if ((emitInv == emitInv))
751751 then {
752752 let emitInvLegacy = match emitInv {
753753 case legacyFactoryContract: Address =>
754754 invoke(legacyFactoryContract, "emit", [amount], nil)
755755 case _ =>
756756 unit
757757 }
758758 if ((emitInvLegacy == emitInvLegacy))
759759 then amount
760760 else throw("Strict value is not equal to itself.")
761761 }
762762 else throw("Strict value is not equal to itself.")
763763 }
764764
765765
766766 func takeFee (amount,fee) = {
767767 let feeAmount = if ((fee == 0))
768768 then 0
769769 else fraction(amount, fee, scale8)
770770 $Tuple2((amount - feeAmount), feeAmount)
771771 }
772772
773773
774774 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
775775 let isEval = (txId == unit)
776776 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
777777 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
778778 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
779779 then true
780780 else if ((paymentAssetId == cfgPriceAssetId))
781781 then false
782782 else throwErr("invalid asset")
783783 let $t03345533748 = if (isEval)
784784 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
785785 else if (paymentInAmountAsset)
786786 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
787787 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
788788 let amountBalanceOld = $t03345533748._1
789789 let priceBalanceOld = $t03345533748._2
790790 let $t03375233901 = if (paymentInAmountAsset)
791791 then $Tuple2(paymentAmountRaw, 0)
792792 else $Tuple2(0, paymentAmountRaw)
793793 let amountAssetAmountRaw = $t03375233901._1
794794 let priceAssetAmountRaw = $t03375233901._2
795795 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
796796 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
797797 let $t03403334097 = takeFee(paymentAmountRaw, inFee)
798798 let paymentAmount = $t03403334097._1
799799 let feeAmount = $t03403334097._2
800800 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
801801 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
802802 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
803803 let priceNew = fromX18(priceNewX18, scale8)
804804 let paymentBalance = if (paymentInAmountAsset)
805805 then amountBalanceOld
806806 else priceBalanceOld
807807 let paymentBalanceBigInt = toBigInt(paymentBalance)
808808 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
809809 let chechSupply = if ((supplyBigInt > big0))
810810 then true
811811 else throwErr("initial deposit requires all coins")
812812 if ((chechSupply == chechSupply))
813813 then {
814814 let depositBigInt = toBigInt(paymentAmount)
815815 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
816816 let commonState = if (isEval)
817817 then nil
818818 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))]
819819 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
820820 let priceOld = fromX18(priceOldX18, scale8)
821821 let loss = {
822822 let $t03577835945 = if (paymentInAmountAsset)
823823 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
824824 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
825825 let amount = $t03577835945._1
826826 let balance = $t03577835945._2
827827 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
828828 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
829829 }
830830 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
831831 }
832832 else throw("Strict value is not equal to itself.")
833833 }
834834
835835
836836 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
837837 let isEval = (txId == unit)
838838 let cfg = getPoolConfig()
839839 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
840840 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
841841 let checks = [if ((paymentAssetId == cfgLpAssetId))
842842 then true
843843 else throwErr("invalid lp asset")]
844844 if ((checks == checks))
845845 then {
846846 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
847847 then true
848848 else if ((outAssetId == cfgPriceAssetId))
849849 then false
850850 else throwErr("invalid asset")
851851 let balanceBigInt = if (outInAmountAsset)
852852 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
853853 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
854854 let outInAmountAssetDecimals = if (outInAmountAsset)
855855 then amtAssetDcm
856856 else priceAssetDcm
857857 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
858858 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
859859 let outBalance = if (outInAmountAsset)
860860 then amBalanceOld
861861 else prBalanceOld
862862 let outBalanceBigInt = toBigInt(outBalance)
863863 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
864864 let redeemedBigInt = toBigInt(paymentAmount)
865865 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
866866 let $t03802338079 = takeFee(amountRaw, outFee)
867867 let totalAmount = $t03802338079._1
868868 let feeAmount = $t03802338079._2
869869 let $t03808338309 = if (outInAmountAsset)
870870 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
871871 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
872872 let outAmAmount = $t03808338309._1
873873 let outPrAmount = $t03808338309._2
874874 let amBalanceNew = $t03808338309._3
875875 let prBalanceNew = $t03808338309._4
876876 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
877877 let priceNew = fromX18(priceNewX18, scale8)
878878 let commonState = if (isEval)
879879 then nil
880880 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)]
881881 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
882882 let priceOld = fromX18(priceOldX18, scale8)
883883 let loss = {
884884 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
885885 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
886886 }
887887 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
888888 }
889889 else throw("Strict value is not equal to itself.")
890890 }
891891
892892
893893 func managerPublicKeyOrUnit () = {
894894 let managerVaultAddress = getManagerVaultAddressOrThis()
895895 match getString(managerVaultAddress, keyManagerPublicKey()) {
896896 case s: String =>
897897 fromBase58String(s)
898898 case _: Unit =>
899899 unit
900900 case _ =>
901901 throw("Match error")
902902 }
903903 }
904904
905905
906906 func isManager (i) = match managerPublicKeyOrUnit() {
907907 case pk: ByteVector =>
908908 (i.callerPublicKey == pk)
909909 case _: Unit =>
910910 (i.caller == this)
911911 case _ =>
912912 throw("Match error")
913913 }
914914
915915
916916 func mustManager (i) = {
917917 let pd = throw("Permission denied")
918918 match managerPublicKeyOrUnit() {
919919 case pk: ByteVector =>
920920 if ((i.callerPublicKey == pk))
921921 then true
922922 else pd
923923 case _: Unit =>
924924 if ((i.caller == this))
925925 then true
926926 else pd
927927 case _ =>
928928 throw("Match error")
929929 }
930930 }
931931
932932
933933 @Callable(i)
934934 func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa())))
935935
936936
937937
938938 @Callable(i)
939939 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
940940 let $t04016740472 = if ((isReverse == false))
941941 then {
942942 let assetOut = getStringOrFail(this, pa())
943943 let assetIn = getStringOrFail(this, aa())
944944 $Tuple2(assetOut, assetIn)
945945 }
946946 else {
947947 let assetOut = getStringOrFail(this, aa())
948948 let assetIn = getStringOrFail(this, pa())
949949 $Tuple2(assetOut, assetIn)
950950 }
951951 let assetOut = $t04016740472._1
952952 let assetIn = $t04016740472._2
953953 let poolAssetInBalance = getAccBalance(assetIn)
954954 let poolAssetOutBalance = getAccBalance(assetOut)
955955 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
956956 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
957957 let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
958958 let checkK = if ((newK >= oldK))
959959 then true
960960 else throw("new K is fewer error")
961961 if ((checkK == checkK))
962962 then $Tuple2(nil, amountOut)
963963 else throw("Strict value is not equal to itself.")
964964 }
965965
966966
967967
968968 @Callable(i)
969969 func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = {
970970 let swapContact = {
971971 let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil)
972972 if ($isInstanceOf(@, "String"))
973973 then @
974974 else throw(($getType(@) + " couldn't be cast to String"))
975975 }
976976 let isPoolSwapDisabled = {
977977 let @ = invoke(factoryContract, "isPoolSwapDisabledREADONLY", [toString(this)], nil)
978978 if ($isInstanceOf(@, "Boolean"))
979979 then @
980980 else throw(($getType(@) + " couldn't be cast to Boolean"))
981981 }
982982 let isSwapDisabled = if (!(isAddressWhitelisted(i.caller)))
983983 then if (if (isGlobalShutdown())
984984 then true
985985 else (cfgPoolStatus == PoolShutdown))
986986 then true
987987 else isPoolSwapDisabled
988988 else false
989989 let checks = [if (if (!(isSwapDisabled))
990990 then true
991991 else isManager(i))
992992 then true
993993 else throwErr("swap operation is blocked by admin"), if ((value(i.payments[0]).amount >= cleanAmountIn))
994994 then true
995995 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
996996 then true
997997 else throwErr("Permission denied")]
998998 if ((checks == checks))
999999 then {
10001000 let pmt = value(i.payments[0])
10011001 let assetIn = assetIdToString(pmt.assetId)
10021002 let assetOut = if ((isReverse == false))
10031003 then getStringOrFail(this, pa())
10041004 else getStringOrFail(this, aa())
1005- let poolAssetInBalance = ((getAccBalance(assetIn) - value(i.payments[0]).amount) - feePoolAmount)
1005+ let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount)
10061006 let poolAssetOutBalance = getAccBalance(assetOut)
10071007 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
10081008 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
1009- let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
1009+ let newK = (toBigInt(getAccBalance(assetIn)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
10101010 let checkK = if ((newK >= oldK))
10111011 then true
10121012 else throw("new K is fewer error")
10131013 if ((checkK == checkK))
10141014 then {
10151015 let checkMin = if ((amountOut >= amountOutMin))
10161016 then true
10171017 else throw("Exchange result is fewer coins than expected")
10181018 if ((checkMin == checkMin))
10191019 then {
1020- let amountAssetBalanceDelta = if (isReverse)
1021- then -(amountOut)
1022- else feePoolAmount
1023- let priceAssetBalanceDelta = if (isReverse)
1024- then feePoolAmount
1025- else -(amountOut)
1026- let refreshKLpActions = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)._1
1027- if ((refreshKLpActions == refreshKLpActions))
1020+ let priceAssetId = getStringOrFail(this, pa())
1021+ let feeAssetId = fromBase58String(priceAssetId)
1022+ let feeAmount = fraction(cleanAmountIn, feePoolAmount, 100)
1023+ let rebalanceState = rebalanceAsset(assetIn)
1024+ if ((rebalanceState == rebalanceState))
10281025 then {
1029- let rebalanceState = rebalanceAsset(assetIn)
1030- if ((rebalanceState == rebalanceState))
1026+ let withdrawState = withdrawAndRebalanceAsset(assetOut, (amountOut + feeAmount))
1027+ if ((withdrawState == withdrawState))
10311028 then {
1032- let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
1033- if ((withdrawState == withdrawState))
1034- then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
1035- else throw("Strict value is not equal to itself.")
1029+ let feeTransfer = ScriptTransfer(feeCollectorAddress, feeAmount, feeAssetId)
1030+ $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), (amountOut - feeAmount), parseAssetId(assetOut)), feeTransfer]), amountOut)
10361031 }
10371032 else throw("Strict value is not equal to itself.")
10381033 }
10391034 else throw("Strict value is not equal to itself.")
10401035 }
10411036 else throw("Strict value is not equal to itself.")
10421037 }
10431038 else throw("Strict value is not equal to itself.")
10441039 }
10451040 else throw("Strict value is not equal to itself.")
10461041 }
10471042
10481043
10491044
10501045 @Callable(i)
10511046 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
10521047 then throw("Invalid slippageTolerance passed")
10531048 else {
10541049 let estPut = commonPut(i, slippageTolerance, true)
10551050 let emitLpAmt = estPut._2
10561051 let lpAssetId = estPut._7
10571052 let state = estPut._9
10581053 let amDiff = estPut._10
10591054 let prDiff = estPut._11
10601055 let amId = estPut._12
10611056 let prId = estPut._13
10621057 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10631058 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10641059 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10651060 if ((currentKLp == currentKLp))
10661061 then {
10671062 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
10681063 if ((emitInv == emitInv))
10691064 then {
10701065 let emitInvLegacy = match emitInv {
10711066 case legacyFactoryContract: Address =>
10721067 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
10731068 case _ =>
10741069 unit
10751070 }
10761071 if ((emitInvLegacy == emitInvLegacy))
10771072 then {
10781073 let slippageAInv = if ((amDiff > 0))
10791074 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
10801075 else nil
10811076 if ((slippageAInv == slippageAInv))
10821077 then {
10831078 let slippagePInv = if ((prDiff > 0))
10841079 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
10851080 else nil
10861081 if ((slippagePInv == slippagePInv))
10871082 then {
10881083 let lpTransfer = if (shouldAutoStake)
10891084 then {
10901085 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
10911086 if ((slpStakeInv == slpStakeInv))
10921087 then nil
10931088 else throw("Strict value is not equal to itself.")
10941089 }
10951090 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1096- let $t04564846110 = refreshKLpInternal(0, 0, 0)
1097- if (($t04564846110 == $t04564846110))
1091+ let $t04559246054 = refreshKLpInternal(0, 0, 0)
1092+ if (($t04559246054 == $t04559246054))
10981093 then {
1099- let updatedKLp = $t04564846110._2
1100- let refreshKLpActions = $t04564846110._1
1094+ let updatedKLp = $t04559246054._2
1095+ let refreshKLpActions = $t04559246054._1
11011096 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11021097 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11031098 then {
11041099 let reb = invoke(this, "rebalance", nil, nil)
11051100 if ((reb == reb))
11061101 then ((state ++ lpTransfer) ++ refreshKLpActions)
11071102 else throw("Strict value is not equal to itself.")
11081103 }
11091104 else throw("Strict value is not equal to itself.")
11101105 }
11111106 else throw("Strict value is not equal to itself.")
11121107 }
11131108 else throw("Strict value is not equal to itself.")
11141109 }
11151110 else throw("Strict value is not equal to itself.")
11161111 }
11171112 else throw("Strict value is not equal to itself.")
11181113 }
11191114 else throw("Strict value is not equal to itself.")
11201115 }
11211116 else throw("Strict value is not equal to itself.")
11221117 }
11231118
11241119
11251120
11261121 @Callable(i)
11271122 func putForFree (maxSlippage) = if ((0 > maxSlippage))
11281123 then throw("Invalid value passed")
11291124 else {
11301125 let estPut = commonPut(i, maxSlippage, false)
11311126 let state = estPut._9
11321127 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
11331128 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
11341129 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
11351130 if ((currentKLp == currentKLp))
11361131 then {
1137- let $t04672246787 = refreshKLpInternal(0, 0, 0)
1138- let refreshKLpActions = $t04672246787._1
1139- let updatedKLp = $t04672246787._2
1132+ let $t04666646731 = refreshKLpInternal(0, 0, 0)
1133+ let refreshKLpActions = $t04666646731._1
1134+ let updatedKLp = $t04666646731._2
11401135 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11411136 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11421137 then (state ++ refreshKLpActions)
11431138 else throw("Strict value is not equal to itself.")
11441139 }
11451140 else throw("Strict value is not equal to itself.")
11461141 }
11471142
11481143
11491144
11501145 @Callable(i)
11511146 func putOneTkn (minOutAmount,autoStake) = {
11521147 let isPoolOneTokenOperationsDisabled = {
11531148 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11541149 if ($isInstanceOf(@, "Boolean"))
11551150 then @
11561151 else throw(($getType(@) + " couldn't be cast to Boolean"))
11571152 }
11581153 let isPutDisabled = if (!(isAddressWhitelisted(i.caller)))
11591154 then if (if (if (isGlobalShutdown())
11601155 then true
11611156 else (cfgPoolStatus == PoolPutDisabled))
11621157 then true
11631158 else (cfgPoolStatus == PoolShutdown))
11641159 then true
11651160 else isPoolOneTokenOperationsDisabled
11661161 else false
11671162 let checks = [if (if (!(isPutDisabled))
11681163 then true
11691164 else isManager(i))
11701165 then true
11711166 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
11721167 then true
11731168 else throwErr("exactly 1 payment are expected")]
11741169 if ((checks == checks))
11751170 then {
11761171 let payment = i.payments[0]
11771172 let paymentAssetId = payment.assetId
11781173 let paymentAmountRaw = payment.amount
11791174 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
11801175 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
11811176 else if ((paymentAssetId == cfgPriceAssetId))
11821177 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
11831178 else throwErr("payment asset is not supported")
11841179 if ((currentKLp == currentKLp))
11851180 then {
11861181 let userAddress = i.caller
11871182 let txId = i.transactionId
1188- let $t04801648168 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1189- if (($t04801648168 == $t04801648168))
1183+ let $t04796048112 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1184+ if (($t04796048112 == $t04796048112))
11901185 then {
1191- let paymentInAmountAsset = $t04801648168._5
1192- let bonus = $t04801648168._4
1193- let feeAmount = $t04801648168._3
1194- let commonState = $t04801648168._2
1195- let emitAmountEstimated = $t04801648168._1
1186+ let paymentInAmountAsset = $t04796048112._5
1187+ let bonus = $t04796048112._4
1188+ let feeAmount = $t04796048112._3
1189+ let commonState = $t04796048112._2
1190+ let emitAmountEstimated = $t04796048112._1
11961191 let emitAmount = if (if ((minOutAmount > 0))
11971192 then (minOutAmount > emitAmountEstimated)
11981193 else false)
11991194 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
12001195 else emitAmountEstimated
12011196 let emitInv = emit(emitAmount)
12021197 if ((emitInv == emitInv))
12031198 then {
12041199 let lpTransfer = if (autoStake)
12051200 then {
12061201 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
12071202 if ((stakeInv == stakeInv))
12081203 then nil
12091204 else throw("Strict value is not equal to itself.")
12101205 }
12111206 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
12121207 let sendFee = if ((feeAmount > 0))
12131208 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
12141209 else nil
1215- let $t04875448951 = if ((this == feeCollectorAddress))
1210+ let $t04869848895 = if ((this == feeCollectorAddress))
12161211 then $Tuple2(0, 0)
12171212 else if (paymentInAmountAsset)
12181213 then $Tuple2(-(feeAmount), 0)
12191214 else $Tuple2(0, -(feeAmount))
1220- let amountAssetBalanceDelta = $t04875448951._1
1221- let priceAssetBalanceDelta = $t04875448951._2
1222- let $t04895449062 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1223- let refreshKLpActions = $t04895449062._1
1224- let updatedKLp = $t04895449062._2
1215+ let amountAssetBalanceDelta = $t04869848895._1
1216+ let priceAssetBalanceDelta = $t04869848895._2
1217+ let $t04889849006 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1218+ let refreshKLpActions = $t04889849006._1
1219+ let updatedKLp = $t04889849006._2
12251220 let kLp = value(getString(keyKLp))
12261221 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12271222 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12281223 then {
12291224 let reb = invoke(this, "rebalance", nil, nil)
12301225 if ((reb == reb))
12311226 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
12321227 else throw("Strict value is not equal to itself.")
12331228 }
12341229 else throw("Strict value is not equal to itself.")
12351230 }
12361231 else throw("Strict value is not equal to itself.")
12371232 }
12381233 else throw("Strict value is not equal to itself.")
12391234 }
12401235 else throw("Strict value is not equal to itself.")
12411236 }
12421237 else throw("Strict value is not equal to itself.")
12431238 }
12441239
12451240
12461241
12471242 @Callable(i)
12481243 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1249- let $t04941749574 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1250- let emitAmountEstimated = $t04941749574._1
1251- let commonState = $t04941749574._2
1252- let feeAmount = $t04941749574._3
1253- let bonus = $t04941749574._4
1254- let paymentInAmountAsset = $t04941749574._5
1244+ let $t04936149518 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1245+ let emitAmountEstimated = $t04936149518._1
1246+ let commonState = $t04936149518._2
1247+ let feeAmount = $t04936149518._3
1248+ let bonus = $t04936149518._4
1249+ let paymentInAmountAsset = $t04936149518._5
12551250 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12561251 }
12571252
12581253
12591254
12601255 @Callable(i)
12611256 func getOneTkn (outAssetIdStr,minOutAmount) = {
12621257 let isPoolOneTokenOperationsDisabled = {
12631258 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12641259 if ($isInstanceOf(@, "Boolean"))
12651260 then @
12661261 else throw(($getType(@) + " couldn't be cast to Boolean"))
12671262 }
12681263 let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
12691264 then if (if (isGlobalShutdown())
12701265 then true
12711266 else (cfgPoolStatus == PoolShutdown))
12721267 then true
12731268 else isPoolOneTokenOperationsDisabled
12741269 else false
12751270 let checks = [if (if (!(isGetDisabled))
12761271 then true
12771272 else isManager(i))
12781273 then true
12791274 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
12801275 then true
12811276 else throwErr("exactly 1 payment are expected")]
12821277 if ((checks == checks))
12831278 then {
12841279 let outAssetId = parseAssetId(outAssetIdStr)
12851280 let payment = i.payments[0]
12861281 let paymentAssetId = payment.assetId
12871282 let paymentAmount = payment.amount
12881283 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12891284 if ((currentKLp == currentKLp))
12901285 then {
12911286 let userAddress = i.caller
12921287 let txId = i.transactionId
1293- let $t05049650649 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1294- if (($t05049650649 == $t05049650649))
1288+ let $t05044050593 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1289+ if (($t05044050593 == $t05044050593))
12951290 then {
1296- let outInAmountAsset = $t05049650649._5
1297- let bonus = $t05049650649._4
1298- let feeAmount = $t05049650649._3
1299- let commonState = $t05049650649._2
1300- let amountEstimated = $t05049650649._1
1291+ let outInAmountAsset = $t05044050593._5
1292+ let bonus = $t05044050593._4
1293+ let feeAmount = $t05044050593._3
1294+ let commonState = $t05044050593._2
1295+ let amountEstimated = $t05044050593._1
13011296 let amount = if (if ((minOutAmount > 0))
13021297 then (minOutAmount > amountEstimated)
13031298 else false)
13041299 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
13051300 else amountEstimated
13061301 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
13071302 if ((burnInv == burnInv))
13081303 then {
13091304 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
13101305 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
13111306 let sendFee = if ((feeAmount > 0))
13121307 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13131308 else nil
1314- let $t05131351560 = {
1309+ let $t05125751504 = {
13151310 let feeAmountForCalc = if ((this == feeCollectorAddress))
13161311 then 0
13171312 else feeAmount
13181313 if (outInAmountAsset)
13191314 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13201315 else $Tuple2(0, -((amount + feeAmountForCalc)))
13211316 }
1322- let amountAssetBalanceDelta = $t05131351560._1
1323- let priceAssetBalanceDelta = $t05131351560._2
1324- let $t05156351671 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1325- let refreshKLpActions = $t05156351671._1
1326- let updatedKLp = $t05156351671._2
1317+ let amountAssetBalanceDelta = $t05125751504._1
1318+ let priceAssetBalanceDelta = $t05125751504._2
1319+ let $t05150751615 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1320+ let refreshKLpActions = $t05150751615._1
1321+ let updatedKLp = $t05150751615._2
13271322 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13281323 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13291324 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13301325 else throw("Strict value is not equal to itself.")
13311326 }
13321327 else throw("Strict value is not equal to itself.")
13331328 }
13341329 else throw("Strict value is not equal to itself.")
13351330 }
13361331 else throw("Strict value is not equal to itself.")
13371332 }
13381333 else throw("Strict value is not equal to itself.")
13391334 }
13401335
13411336
13421337
13431338 @Callable(i)
13441339 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1345- let $t05194952105 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1346- let amountEstimated = $t05194952105._1
1347- let commonState = $t05194952105._2
1348- let feeAmount = $t05194952105._3
1349- let bonus = $t05194952105._4
1350- let outInAmountAsset = $t05194952105._5
1340+ let $t05189352049 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1341+ let amountEstimated = $t05189352049._1
1342+ let commonState = $t05189352049._2
1343+ let feeAmount = $t05189352049._3
1344+ let bonus = $t05189352049._4
1345+ let outInAmountAsset = $t05189352049._5
13511346 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13521347 }
13531348
13541349
13551350
13561351 @Callable(i)
13571352 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
13581353 let isPoolOneTokenOperationsDisabled = {
13591354 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13601355 if ($isInstanceOf(@, "Boolean"))
13611356 then @
13621357 else throw(($getType(@) + " couldn't be cast to Boolean"))
13631358 }
13641359 let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
13651360 then if (if (isGlobalShutdown())
13661361 then true
13671362 else (cfgPoolStatus == PoolShutdown))
13681363 then true
13691364 else isPoolOneTokenOperationsDisabled
13701365 else false
13711366 let checks = [if (if (!(isGetDisabled))
13721367 then true
13731368 else isManager(i))
13741369 then true
13751370 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13761371 then true
13771372 else throwErr("no payments are expected")]
13781373 if ((checks == checks))
13791374 then {
13801375 let outAssetId = parseAssetId(outAssetIdStr)
13811376 let userAddress = i.caller
13821377 let txId = i.transactionId
13831378 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13841379 if ((currentKLp == currentKLp))
13851380 then {
13861381 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13871382 if ((unstakeInv == unstakeInv))
13881383 then {
1389- let $t05304753198 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1390- if (($t05304753198 == $t05304753198))
1384+ let $t05299153142 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1385+ if (($t05299153142 == $t05299153142))
13911386 then {
1392- let outInAmountAsset = $t05304753198._5
1393- let bonus = $t05304753198._4
1394- let feeAmount = $t05304753198._3
1395- let commonState = $t05304753198._2
1396- let amountEstimated = $t05304753198._1
1387+ let outInAmountAsset = $t05299153142._5
1388+ let bonus = $t05299153142._4
1389+ let feeAmount = $t05299153142._3
1390+ let commonState = $t05299153142._2
1391+ let amountEstimated = $t05299153142._1
13971392 let amount = if (if ((minOutAmount > 0))
13981393 then (minOutAmount > amountEstimated)
13991394 else false)
14001395 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
14011396 else amountEstimated
14021397 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
14031398 if ((burnInv == burnInv))
14041399 then {
14051400 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
14061401 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
14071402 let sendFee = if ((feeAmount > 0))
14081403 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
14091404 else nil
1410- let $t05385754104 = {
1405+ let $t05380154048 = {
14111406 let feeAmountForCalc = if ((this == feeCollectorAddress))
14121407 then 0
14131408 else feeAmount
14141409 if (outInAmountAsset)
14151410 then $Tuple2(-((amount + feeAmountForCalc)), 0)
14161411 else $Tuple2(0, -((amount + feeAmountForCalc)))
14171412 }
1418- let amountAssetBalanceDelta = $t05385754104._1
1419- let priceAssetBalanceDelta = $t05385754104._2
1420- let $t05410754215 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1421- let refreshKLpActions = $t05410754215._1
1422- let updatedKLp = $t05410754215._2
1413+ let amountAssetBalanceDelta = $t05380154048._1
1414+ let priceAssetBalanceDelta = $t05380154048._2
1415+ let $t05405154159 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1416+ let refreshKLpActions = $t05405154159._1
1417+ let updatedKLp = $t05405154159._2
14231418 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14241419 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14251420 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
14261421 else throw("Strict value is not equal to itself.")
14271422 }
14281423 else throw("Strict value is not equal to itself.")
14291424 }
14301425 else throw("Strict value is not equal to itself.")
14311426 }
14321427 else throw("Strict value is not equal to itself.")
14331428 }
14341429 else throw("Strict value is not equal to itself.")
14351430 }
14361431 else throw("Strict value is not equal to itself.")
14371432 }
14381433
14391434
14401435
14411436 @Callable(i)
14421437 func get () = {
14431438 let res = commonGet(i)
14441439 let outAmAmt = res._1
14451440 let outPrAmt = res._2
14461441 let pmtAmt = res._3
14471442 let pmtAssetId = res._4
14481443 let state = res._5
14491444 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14501445 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14511446 if ((currentKLp == currentKLp))
14521447 then {
14531448 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14541449 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14551450 then {
1456- let $t05531055391 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1457- let refreshKLpActions = $t05531055391._1
1458- let updatedKLp = $t05531055391._2
1451+ let $t05525455335 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1452+ let refreshKLpActions = $t05525455335._1
1453+ let updatedKLp = $t05525455335._2
14591454 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14601455 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14611456 then ((withdrawState ++ state) ++ refreshKLpActions)
14621457 else throw("Strict value is not equal to itself.")
14631458 }
14641459 else throw("Strict value is not equal to itself.")
14651460 }
14661461 else throw("Strict value is not equal to itself.")
14671462 }
14681463
14691464
14701465
14711466 @Callable(i)
14721467 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
14731468 let res = commonGet(i)
14741469 let outAmAmt = res._1
14751470 let outPrAmt = res._2
14761471 let pmtAmt = res._3
14771472 let pmtAssetId = res._4
14781473 let state = res._5
14791474 if ((noLessThenAmtAsset > outAmAmt))
14801475 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
14811476 else if ((noLessThenPriceAsset > outPrAmt))
14821477 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14831478 else {
14841479 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14851480 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14861481 if ((currentKLp == currentKLp))
14871482 then {
14881483 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14891484 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14901485 then {
1491- let $t05648656567 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1492- let refreshKLpActions = $t05648656567._1
1493- let updatedKLp = $t05648656567._2
1486+ let $t05643056511 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1487+ let refreshKLpActions = $t05643056511._1
1488+ let updatedKLp = $t05643056511._2
14941489 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14951490 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14961491 then ((withdrawState ++ state) ++ refreshKLpActions)
14971492 else throw("Strict value is not equal to itself.")
14981493 }
14991494 else throw("Strict value is not equal to itself.")
15001495 }
15011496 else throw("Strict value is not equal to itself.")
15021497 }
15031498 }
15041499
15051500
15061501
15071502 @Callable(i)
15081503 func unstakeAndGet (amount) = {
15091504 let checkPayments = if ((size(i.payments) != 0))
15101505 then throw("No payments are expected")
15111506 else true
15121507 if ((checkPayments == checkPayments))
15131508 then {
15141509 let cfg = getPoolConfig()
15151510 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
15161511 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15171512 if ((currentKLp == currentKLp))
15181513 then {
15191514 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
15201515 if ((unstakeInv == unstakeInv))
15211516 then {
15221517 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
15231518 let outAmAmt = res._1
15241519 let outPrAmt = res._2
15251520 let poolStatus = parseIntValue(res._9)
15261521 let state = res._10
15271522 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
15281523 let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
15291524 then if (isGlobalShutdown())
15301525 then true
15311526 else (cfgPoolStatus == PoolShutdown)
15321527 else false
15331528 let checkPoolStatus = if (isGetDisabled)
15341529 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
15351530 else true
15361531 if ((checkPoolStatus == checkPoolStatus))
15371532 then {
15381533 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
15391534 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15401535 then {
1541- let $t05791557996 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1542- let refreshKLpActions = $t05791557996._1
1543- let updatedKLp = $t05791557996._2
1536+ let $t05785957940 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1537+ let refreshKLpActions = $t05785957940._1
1538+ let updatedKLp = $t05785957940._2
15441539 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15451540 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15461541 then ((withdrawState ++ state) ++ refreshKLpActions)
15471542 else throw("Strict value is not equal to itself.")
15481543 }
15491544 else throw("Strict value is not equal to itself.")
15501545 }
15511546 else throw("Strict value is not equal to itself.")
15521547 }
15531548 else throw("Strict value is not equal to itself.")
15541549 }
15551550 else throw("Strict value is not equal to itself.")
15561551 }
15571552 else throw("Strict value is not equal to itself.")
15581553 }
15591554
15601555
15611556
15621557 @Callable(i)
15631558 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
15641559 let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
15651560 then if (isGlobalShutdown())
15661561 then true
15671562 else (cfgPoolStatus == PoolShutdown)
15681563 else false
15691564 let checks = [if (!(isGetDisabled))
15701565 then true
15711566 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15721567 then true
15731568 else throw("no payments are expected")]
15741569 if ((checks == checks))
15751570 then {
15761571 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15771572 if ((currentKLp == currentKLp))
15781573 then {
15791574 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
15801575 if ((unstakeInv == unstakeInv))
15811576 then {
15821577 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
15831578 let outAmAmt = res._1
15841579 let outPrAmt = res._2
15851580 let state = res._10
15861581 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
15871582 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15881583 then true
15891584 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15901585 then true
15911586 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
15921587 if ((checkAmounts == checkAmounts))
15931588 then {
15941589 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15951590 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15961591 then {
1597- let $t05947459555 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1598- let refreshKLpActions = $t05947459555._1
1599- let updatedKLp = $t05947459555._2
1592+ let $t05941859499 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1593+ let refreshKLpActions = $t05941859499._1
1594+ let updatedKLp = $t05941859499._2
16001595 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
16011596 if ((isUpdatedKLpValid == isUpdatedKLpValid))
16021597 then ((withdrawState ++ state) ++ refreshKLpActions)
16031598 else throw("Strict value is not equal to itself.")
16041599 }
16051600 else throw("Strict value is not equal to itself.")
16061601 }
16071602 else throw("Strict value is not equal to itself.")
16081603 }
16091604 else throw("Strict value is not equal to itself.")
16101605 }
16111606 else throw("Strict value is not equal to itself.")
16121607 }
16131608 else throw("Strict value is not equal to itself.")
16141609 }
16151610
16161611
16171612
16181613 @Callable(i)
16191614 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
16201615 then throw("permissions denied")
16211616 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
16221617
16231618
16241619
16251620 @Callable(i)
16261621 func refreshKLp () = {
16271622 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
16281623 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
16291624 then unit
16301625 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
16311626 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
16321627 then {
16331628 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1634- let $t06075960823 = refreshKLpInternal(0, 0, 0)
1635- let kLpUpdateActions = $t06075960823._1
1636- let updatedKLp = $t06075960823._2
1629+ let $t06070360767 = refreshKLpInternal(0, 0, 0)
1630+ let kLpUpdateActions = $t06070360767._1
1631+ let updatedKLp = $t06070360767._2
16371632 let actions = if ((kLp != updatedKLp))
16381633 then kLpUpdateActions
16391634 else throwErr("nothing to refresh")
16401635 $Tuple2(actions, toString(updatedKLp))
16411636 }
16421637 else throw("Strict value is not equal to itself.")
16431638 }
16441639
16451640
16461641
16471642 @Callable(i)
16481643 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
16491644
16501645
16511646
16521647 @Callable(i)
16531648 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
16541649
16551650
16561651
16571652 @Callable(i)
16581653 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
16591654 let prices = calcPrices(amAmt, prAmt, lpAmt)
16601655 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
16611656 }
16621657
16631658
16641659
16651660 @Callable(i)
16661661 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
16671662
16681663
16691664
16701665 @Callable(i)
16711666 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
16721667
16731668
16741669
16751670 @Callable(i)
16761671 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
16771672
16781673
16791674
16801675 @Callable(i)
16811676 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
16821677
16831678
16841679
16851680 @Callable(i)
16861681 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
16871682 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
16881683 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
16891684 }
16901685
16911686
16921687
16931688 @Callable(i)
16941689 func statsREADONLY () = {
16951690 let cfg = getPoolConfig()
16961691 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16971692 let amtAssetId = cfg[idxAmtAssetId]
16981693 let priceAssetId = cfg[idxPriceAssetId]
16991694 let iAmtAssetId = cfg[idxIAmtAssetId]
17001695 let iPriceAssetId = cfg[idxIPriceAssetId]
17011696 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
17021697 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17031698 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17041699 let accAmtAssetBalance = getAccBalance(amtAssetId)
17051700 let accPriceAssetBalance = getAccBalance(priceAssetId)
17061701 let pricesList = if ((poolLPBalance == 0))
17071702 then [zeroBigInt, zeroBigInt, zeroBigInt]
17081703 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
17091704 let curPrice = 0
17101705 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
17111706 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
17121707 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
17131708 $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))
17141709 }
17151710
17161711
17171712
17181713 @Callable(i)
17191714 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
17201715 let cfg = getPoolConfig()
17211716 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
17221717 let amAssetIdStr = cfg[idxAmtAssetId]
17231718 let amAssetId = fromBase58String(amAssetIdStr)
17241719 let prAssetIdStr = cfg[idxPriceAssetId]
17251720 let prAssetId = fromBase58String(prAssetIdStr)
17261721 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
17271722 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17281723 let poolStatus = cfg[idxPoolStatus]
17291724 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17301725 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
17311726 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
17321727 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
17331728 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
17341729 let curPriceX18 = if ((poolLPBalance == 0))
17351730 then zeroBigInt
17361731 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
17371732 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
17381733 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
17391734 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
17401735 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17411736 let calcLpAmt = estPut._1
17421737 let curPriceCalc = estPut._3
17431738 let amBalance = estPut._4
17441739 let prBalance = estPut._5
17451740 let lpEmission = estPut._6
17461741 $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))
17471742 }
17481743
17491744
17501745
17511746 @Callable(i)
17521747 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
17531748 let cfg = getPoolConfig()
17541749 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
17551750 let amAssetIdStr = cfg[idxAmtAssetId]
17561751 let amAssetId = fromBase58String(amAssetIdStr)
17571752 let prAssetIdStr = cfg[idxPriceAssetId]
17581753 let prAssetId = fromBase58String(prAssetIdStr)
17591754 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
17601755 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17611756 let poolStatus = cfg[idxPoolStatus]
17621757 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17631758 let amBalanceRaw = getAccBalance(amAssetIdStr)
17641759 let prBalanceRaw = getAccBalance(prAssetIdStr)
17651760 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
17661761 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
17671762 let curPriceX18 = if ((poolLPBalance == 0))
17681763 then zeroBigInt
17691764 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
17701765 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
17711766 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
17721767 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
17731768 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17741769 let calcLpAmt = estPut._1
17751770 let curPriceCalc = estPut._3
17761771 let amBalance = estPut._4
17771772 let prBalance = estPut._5
17781773 let lpEmission = estPut._6
17791774 $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))
17801775 }
17811776
17821777
17831778
17841779 @Callable(i)
17851780 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
17861781 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
17871782 let outAmAmt = res._1
17881783 let outPrAmt = res._2
17891784 let amBalance = res._5
17901785 let prBalance = res._6
17911786 let lpEmission = res._7
17921787 let curPrice = res._8
17931788 let poolStatus = parseIntValue(res._9)
17941789 $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))
17951790 }
17961791
17971792
17981793 @Verifier(tx)
17991794 func verify () = {
18001795 let targetPublicKey = match managerPublicKeyOrUnit() {
18011796 case pk: ByteVector =>
18021797 pk
18031798 case _: Unit =>
18041799 tx.senderPublicKey
18051800 case _ =>
18061801 throw("Match error")
18071802 }
18081803 match tx {
18091804 case order: Order =>
18101805 let matcherPub = getMatcherPubOrFail()
1811- let $t06948569602 = if (skipOrderValidation())
1806+ let $t06942969546 = if (skipOrderValidation())
18121807 then $Tuple2(true, "")
18131808 else validateMatcherOrderAllowed(order)
1814- let orderValid = $t06948569602._1
1815- let orderValidInfo = $t06948569602._2
1809+ let orderValid = $t06942969546._1
1810+ let orderValidInfo = $t06942969546._2
18161811 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
18171812 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
18181813 if (if (if (orderValid)
18191814 then senderValid
18201815 else false)
18211816 then matcherValid
18221817 else false)
18231818 then true
18241819 else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid)
18251820 case s: SetScriptTransaction =>
18261821 if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey))
18271822 then true
18281823 else {
18291824 let newHash = blake2b256(value(s.script))
18301825 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
18311826 let currentHash = scriptHash(this)
18321827 if ((allowedHash == newHash))
18331828 then (currentHash != newHash)
18341829 else false
18351830 }
18361831 case _ =>
18371832 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
18381833 }
18391834 }
18401835

github/deemru/w8io/169f3d6 
238.96 ms