tx · DtzTm77mvFDhSeaBhnpLezesXjoSH1Ef3tZfRoBjCt56

3N1idCKiBqZMYCpvFC3n3FTTRFJPjNq8NVB:  -0.04300000 Waves

2023.12.26 15:40 [2903727] smart account 3N1idCKiBqZMYCpvFC3n3FTTRFJPjNq8NVB > SELF 0.00000000 Waves

{ "type": 13, "id": "DtzTm77mvFDhSeaBhnpLezesXjoSH1Ef3tZfRoBjCt56", "fee": 4300000, "feeAssetId": null, "timestamp": 1703594445237, "version": 2, "chainId": 84, "sender": "3N1idCKiBqZMYCpvFC3n3FTTRFJPjNq8NVB", "senderPublicKey": "48qAWHY8GVxLnTESeyZUVjyuNCWtV8YBG8Kc6YneD79k", "proofs": [ "gNwEm1eMFMWVtAVKRSsQobfLFXcvKeZrPBQokvpx6q3hetZQFrztm9EXQ5zP9VZwC8S4j7LrG8dyFJeEukocNdq" ], "script": "base64:BgLjOAgCEgASBQoDAQQBEgcKBQEEAQgBEgQKAgEEEgMKAQESBAoCAQQSBAoCCAESBAoCCAESBAoCCAESBQoDAQgBEgASBAoCAQESAwoBARIFCgMBAQESBAoCCAgSABIAEgMKAQgSBQoDAQEBEgQKAgEBEgQKAggBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgASAwoBARIDCgEBEgQKAggBIgpsUGRlY2ltYWxzIgZzY2FsZTgiDHNjYWxlOEJpZ0ludCIHc2NhbGUxOCIKemVyb0JpZ0ludCIEYmlnMCIEYmlnMSIEYmlnMiILd2F2ZXNTdHJpbmciA1NFUCIKUG9vbEFjdGl2ZSIPUG9vbFB1dERpc2FibGVkIhNQb29sTWF0Y2hlckRpc2FibGVkIgxQb29sU2h1dGRvd24iDmlkeFBvb2xBZGRyZXNzIg1pZHhQb29sU3RhdHVzIhBpZHhQb29sTFBBc3NldElkIg1pZHhBbXRBc3NldElkIg9pZHhQcmljZUFzc2V0SWQiDmlkeEFtdEFzc2V0RGNtIhBpZHhQcmljZUFzc2V0RGNtIg5pZHhJQW10QXNzZXRJZCIQ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JhUQUCZ3UDCQABAgUCYVECBFVuaXQIBQJpbQ9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgQCYVEFAmltAwkAAQIFAmFRAgVPcmRlcgQCZVMFAmFRBAJpcAkBAmJsAAQCaXEDCQECZU8ACQCUCgIGAgAJAQJlUgEFAmVTBAJhSwgFAmlxAl8xBAJhTAgFAmlxAl8yBAJhTQkA9AMDCAUCZVMJYm9keUJ5dGVzCQCRAwIIBQJlUwZwcm9vZnMAAAgFAmVTD3NlbmRlclB1YmxpY0tleQQCYU4JAPQDAwgFAmVTCWJvZHlCeXRlcwkAkQMCCAUCZVMGcHJvb2ZzAAEFAmlwAwMDBQJhSwUCYU0HBQJhTgcGCQECYUoEBQJhSwUCYUwFAmFNBQJhTgMJAAECBQJhUQIUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAmFWBQJhUQMJAPQDAwgFAmltCWJvZHlCeXRlcwkAkQMCCAUCaW0GcHJvb2ZzAAAFAmlvBgQCaXIJAPYDAQkBBXZhbHVlAQgFAmFWBnNjcmlwdAQCaXMJANsEAQkBBXZhbHVlAQkAnQgCBQJiZAkBAmFGAAQCaXQJAPEHAQUEdGhpcwMJAAACBQJpcwUCaXIJAQIhPQIFAml0BQJpcgcJAPQDAwgFAmltCWJvZHlCeXRlcwkAkQMCCAUCaW0GcHJvb2ZzAAAFAmlv1lDrtA==", "height": 2903727, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BvbnH8tfPfBQAun45C9NTqEiycr6T8RF4wZCaoCnRuiY Next: GtGs22pv1Fkxz8EFAU2QByTw3ri66W8VHr4Yez5c5Ukp Diff:
OldNewDifferences
228228 else throw(($getType(@) + " couldn't be cast to Int"))
229229 }
230230
231+func keyAddressWhitelisted (address) = makeString(["%s%s", "whitelisted", toString(address)], SEP)
232+
233+
234+func isAddressWhitelisted (address) = valueOrElse(getBoolean(factoryContract, keyAddressWhitelisted(address)), false)
235+
236+
231237 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
232238
233239
258264
259265 let poolConfigParsed = parsePoolConfig(getPoolConfig())
260266
261-let $t095299695 = poolConfigParsed
267+let $t097699935 = poolConfigParsed
262268
263-let cfgPoolAddress = $t095299695._1
269+let cfgPoolAddress = $t097699935._1
264270
265-let cfgPoolStatus = $t095299695._2
271+let cfgPoolStatus = $t097699935._2
266272
267-let cfgLpAssetId = $t095299695._3
273+let cfgLpAssetId = $t097699935._3
268274
269-let cfgAmountAssetId = $t095299695._4
275+let cfgAmountAssetId = $t097699935._4
270276
271-let cfgPriceAssetId = $t095299695._5
277+let cfgPriceAssetId = $t097699935._5
272278
273-let cfgAmountAssetDecimals = $t095299695._6
279+let cfgAmountAssetDecimals = $t097699935._6
274280
275-let cfgPriceAssetDecimals = $t095299695._7
281+let cfgPriceAssetDecimals = $t097699935._7
276282
277283 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
278284
421427
422428
423429 func rebalanceAsset (assetId) = {
424- let $t01593116067 = getLeaseProxyConfig(assetId)
425- let isLeasable = $t01593116067._1
426- let leasedRatio = $t01593116067._2
427- let minBalance = $t01593116067._3
428- let proxyAddress = $t01593116067._4
429- let proxyAssetId = $t01593116067._5
430- let proxyRateMul = $t01593116067._6
431- let stakingProfitAddress = $t01593116067._7
430+ let $t01617116307 = getLeaseProxyConfig(assetId)
431+ let isLeasable = $t01617116307._1
432+ let leasedRatio = $t01617116307._2
433+ let minBalance = $t01617116307._3
434+ let proxyAddress = $t01617116307._4
435+ let proxyAssetId = $t01617116307._5
436+ let proxyRateMul = $t01617116307._6
437+ let stakingProfitAddress = $t01617116307._7
432438 if (isLeasable)
433439 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
434440 else nil
436442
437443
438444 func withdrawAndRebalanceAsset (assetId,getAmount) = {
439- let $t01646616602 = getLeaseProxyConfig(assetId)
440- let isLeasable = $t01646616602._1
441- let leasedRatio = $t01646616602._2
442- let minBalance = $t01646616602._3
443- let proxyAddress = $t01646616602._4
444- let proxyAssetId = $t01646616602._5
445- let proxyRateMul = $t01646616602._6
446- let stakingProfitAddress = $t01646616602._7
445+ let $t01670616842 = getLeaseProxyConfig(assetId)
446+ let isLeasable = $t01670616842._1
447+ let leasedRatio = $t01670616842._2
448+ let minBalance = $t01670616842._3
449+ let proxyAddress = $t01670616842._4
450+ let proxyAssetId = $t01670616842._5
451+ let proxyRateMul = $t01670616842._6
452+ let stakingProfitAddress = $t01670616842._7
447453 if (isLeasable)
448454 then {
449455 let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
656662 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
657663 let amountAssetAmount = order.amount
658664 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
659- let $t02899129203 = if ((order.orderType == Buy))
665+ let $t02923129443 = if ((order.orderType == Buy))
660666 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
661667 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
662- let amountAssetBalanceDelta = $t02899129203._1
663- let priceAssetBalanceDelta = $t02899129203._2
668+ let amountAssetBalanceDelta = $t02923129443._1
669+ let priceAssetBalanceDelta = $t02923129443._2
664670 if (if (if (isGlobalShutdown())
665671 then true
666672 else (cfgPoolStatus == PoolMatcherDisabled))
673679 then throw("Wrong order assets.")
674680 else {
675681 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
676- let $t02964329743 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
677- let unusedActions = $t02964329743._1
678- let kLpNew = $t02964329743._2
682+ let $t02988329983 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
683+ let unusedActions = $t02988329983._1
684+ let kLpNew = $t02988329983._2
679685 let isOrderValid = (kLpNew >= kLp)
680686 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
681687 $Tuple2(isOrderValid, info)
692698 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
693699 let outAmAmt = res._1
694700 let outPrAmt = res._2
695- let poolStatus = parseIntValue(res._9)
696701 let state = res._10
697- if (if (isGlobalShutdown())
698- then true
699- else (poolStatus == PoolShutdown))
700- then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
702+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
703+ then if (isGlobalShutdown())
704+ then true
705+ else (cfgPoolStatus == PoolShutdown)
706+ else false
707+ if (isGetDisabled)
708+ then throw(("Get operation is blocked by admin. Status = " + toString(cfgPoolStatus)))
701709 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
702710 }
703711
708716 let amAssetPmt = value(i.payments[0])
709717 let prAssetPmt = value(i.payments[1])
710718 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
711- let poolStatus = parseIntValue(estPut._8)
712- if (if (if (isGlobalShutdown())
713- then true
714- else (poolStatus == PoolPutDisabled))
715- then true
716- else (poolStatus == PoolShutdown))
717- then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
719+ let isPutDisabled = if (!(isAddressWhitelisted(i.caller)))
720+ then if (if (isGlobalShutdown())
721+ then true
722+ else (cfgPoolStatus == PoolPutDisabled))
723+ then true
724+ else (cfgPoolStatus == PoolShutdown)
725+ else false
726+ if (isPutDisabled)
727+ then throw(("Put operation is blocked by admin. Status = " + toString(cfgPoolStatus)))
718728 else estPut
719729 }
720730
754764 else if ((paymentAssetId == cfgPriceAssetId))
755765 then false
756766 else throwErr("invalid asset")
757- let $t03285633149 = if (isEval)
767+ let $t03316933462 = if (isEval)
758768 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
759769 else if (paymentInAmountAsset)
760770 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
761771 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
762- let amountBalanceOld = $t03285633149._1
763- let priceBalanceOld = $t03285633149._2
764- let $t03315333302 = if (paymentInAmountAsset)
772+ let amountBalanceOld = $t03316933462._1
773+ let priceBalanceOld = $t03316933462._2
774+ let $t03346633615 = if (paymentInAmountAsset)
765775 then $Tuple2(paymentAmountRaw, 0)
766776 else $Tuple2(0, paymentAmountRaw)
767- let amountAssetAmountRaw = $t03315333302._1
768- let priceAssetAmountRaw = $t03315333302._2
777+ let amountAssetAmountRaw = $t03346633615._1
778+ let priceAssetAmountRaw = $t03346633615._2
769779 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
770780 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
771- let $t03343433498 = takeFee(paymentAmountRaw, inFee)
772- let paymentAmount = $t03343433498._1
773- let feeAmount = $t03343433498._2
781+ let $t03374733811 = takeFee(paymentAmountRaw, inFee)
782+ let paymentAmount = $t03374733811._1
783+ let feeAmount = $t03374733811._2
774784 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
775785 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
776786 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
793803 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
794804 let priceOld = fromX18(priceOldX18, scale8)
795805 let loss = {
796- let $t03517935346 = if (paymentInAmountAsset)
806+ let $t03549235659 = if (paymentInAmountAsset)
797807 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
798808 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
799- let amount = $t03517935346._1
800- let balance = $t03517935346._2
809+ let amount = $t03549235659._1
810+ let balance = $t03549235659._2
801811 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
802812 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
803813 }
837847 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
838848 let redeemedBigInt = toBigInt(paymentAmount)
839849 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
840- let $t03742437480 = takeFee(amountRaw, outFee)
841- let totalAmount = $t03742437480._1
842- let feeAmount = $t03742437480._2
843- let $t03748437710 = if (outInAmountAsset)
850+ let $t03773737793 = takeFee(amountRaw, outFee)
851+ let totalAmount = $t03773737793._1
852+ let feeAmount = $t03773737793._2
853+ let $t03779738023 = if (outInAmountAsset)
844854 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
845855 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
846- let outAmAmount = $t03748437710._1
847- let outPrAmount = $t03748437710._2
848- let amBalanceNew = $t03748437710._3
849- let prBalanceNew = $t03748437710._4
856+ let outAmAmount = $t03779738023._1
857+ let outPrAmount = $t03779738023._2
858+ let amBalanceNew = $t03779738023._3
859+ let prBalanceNew = $t03779738023._4
850860 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
851861 let priceNew = fromX18(priceNewX18, scale8)
852862 let commonState = if (isEval)
911921
912922 @Callable(i)
913923 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
914- let $t03956839873 = if ((isReverse == false))
924+ let $t03988140186 = if ((isReverse == false))
915925 then {
916926 let assetOut = getStringOrFail(this, pa())
917927 let assetIn = getStringOrFail(this, aa())
922932 let assetIn = getStringOrFail(this, pa())
923933 $Tuple2(assetOut, assetIn)
924934 }
925- let assetOut = $t03956839873._1
926- let assetIn = $t03956839873._2
935+ let assetOut = $t03988140186._1
936+ let assetIn = $t03988140186._2
927937 let poolAssetInBalance = getAccBalance(assetIn)
928938 let poolAssetOutBalance = getAccBalance(assetOut)
929939 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
947957 then @
948958 else throw(($getType(@) + " couldn't be cast to String"))
949959 }
950- let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
960+ let isPoolSwapDisabled = {
961+ let @ = invoke(factoryContract, "isPoolSwapDisabledREADONLY", [toString(this)], nil)
962+ if ($isInstanceOf(@, "Boolean"))
963+ then @
964+ else throw(($getType(@) + " couldn't be cast to Boolean"))
965+ }
966+ let isSwapDisabled = if (!(isAddressWhitelisted(i.caller)))
967+ then if (if (isGlobalShutdown())
968+ then true
969+ else (cfgPoolStatus == PoolShutdown))
970+ then true
971+ else isPoolSwapDisabled
972+ else false
973+ let checks = [if (if (!(isSwapDisabled))
974+ then true
975+ else isManager(i))
976+ then true
977+ else throwErr("swap operation is blocked by admin"), if ((value(i.payments[0]).amount >= cleanAmountIn))
951978 then true
952979 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
953980 then true
9741001 else throw("Exchange result is fewer coins than expected")
9751002 if ((checkMin == checkMin))
9761003 then {
977- let rebalanceState = rebalanceAsset(assetIn)
978- if ((rebalanceState == rebalanceState))
1004+ let amountAssetBalanceDelta = if (isReverse)
1005+ then -(amountOut)
1006+ else feePoolAmount
1007+ let priceAssetBalanceDelta = if (isReverse)
1008+ then feePoolAmount
1009+ else -(amountOut)
1010+ let refreshKLpActions = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)._1
1011+ if ((refreshKLpActions == refreshKLpActions))
9791012 then {
980- let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
981- if ((withdrawState == withdrawState))
982- then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
1013+ let rebalanceState = rebalanceAsset(assetIn)
1014+ if ((rebalanceState == rebalanceState))
1015+ then {
1016+ let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
1017+ if ((withdrawState == withdrawState))
1018+ then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
1019+ else throw("Strict value is not equal to itself.")
1020+ }
9831021 else throw("Strict value is not equal to itself.")
9841022 }
9851023 else throw("Strict value is not equal to itself.")
10391077 else throw("Strict value is not equal to itself.")
10401078 }
10411079 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1042- let $t04437644838 = refreshKLpInternal(0, 0, 0)
1043- if (($t04437644838 == $t04437644838))
1080+ let $t04536245824 = refreshKLpInternal(0, 0, 0)
1081+ if (($t04536245824 == $t04536245824))
10441082 then {
1045- let updatedKLp = $t04437644838._2
1046- let refreshKLpActions = $t04437644838._1
1083+ let updatedKLp = $t04536245824._2
1084+ let refreshKLpActions = $t04536245824._1
10471085 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10481086 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10491087 then {
10801118 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10811119 if ((currentKLp == currentKLp))
10821120 then {
1083- let $t04545045515 = refreshKLpInternal(0, 0, 0)
1084- let refreshKLpActions = $t04545045515._1
1085- let updatedKLp = $t04545045515._2
1121+ let $t04643646501 = refreshKLpInternal(0, 0, 0)
1122+ let refreshKLpActions = $t04643646501._1
1123+ let updatedKLp = $t04643646501._2
10861124 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10871125 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10881126 then (state ++ refreshKLpActions)
11011139 then @
11021140 else throw(($getType(@) + " couldn't be cast to Boolean"))
11031141 }
1104- let isPutDisabled = if (if (if (isGlobalShutdown())
1105- then true
1106- else (cfgPoolStatus == PoolPutDisabled))
1107- then true
1108- else (cfgPoolStatus == PoolShutdown))
1109- then true
1110- else isPoolOneTokenOperationsDisabled
1142+ let isPutDisabled = if (!(isAddressWhitelisted(i.caller)))
1143+ then if (if (if (isGlobalShutdown())
1144+ then true
1145+ else (cfgPoolStatus == PoolPutDisabled))
1146+ then true
1147+ else (cfgPoolStatus == PoolShutdown))
1148+ then true
1149+ else isPoolOneTokenOperationsDisabled
1150+ else false
11111151 let checks = [if (if (!(isPutDisabled))
11121152 then true
11131153 else isManager(i))
11291169 then {
11301170 let userAddress = i.caller
11311171 let txId = i.transactionId
1132- let $t04670346855 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1133- if (($t04670346855 == $t04670346855))
1172+ let $t04773047882 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1173+ if (($t04773047882 == $t04773047882))
11341174 then {
1135- let paymentInAmountAsset = $t04670346855._5
1136- let bonus = $t04670346855._4
1137- let feeAmount = $t04670346855._3
1138- let commonState = $t04670346855._2
1139- let emitAmountEstimated = $t04670346855._1
1175+ let paymentInAmountAsset = $t04773047882._5
1176+ let bonus = $t04773047882._4
1177+ let feeAmount = $t04773047882._3
1178+ let commonState = $t04773047882._2
1179+ let emitAmountEstimated = $t04773047882._1
11401180 let emitAmount = if (if ((minOutAmount > 0))
11411181 then (minOutAmount > emitAmountEstimated)
11421182 else false)
11561196 let sendFee = if ((feeAmount > 0))
11571197 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11581198 else nil
1159- let $t04744147638 = if ((this == feeCollectorAddress))
1199+ let $t04846848665 = if ((this == feeCollectorAddress))
11601200 then $Tuple2(0, 0)
11611201 else if (paymentInAmountAsset)
11621202 then $Tuple2(-(feeAmount), 0)
11631203 else $Tuple2(0, -(feeAmount))
1164- let amountAssetBalanceDelta = $t04744147638._1
1165- let priceAssetBalanceDelta = $t04744147638._2
1166- let $t04764147749 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1167- let refreshKLpActions = $t04764147749._1
1168- let updatedKLp = $t04764147749._2
1204+ let amountAssetBalanceDelta = $t04846848665._1
1205+ let priceAssetBalanceDelta = $t04846848665._2
1206+ let $t04866848776 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1207+ let refreshKLpActions = $t04866848776._1
1208+ let updatedKLp = $t04866848776._2
11691209 let kLp = value(getString(keyKLp))
11701210 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11711211 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11901230
11911231 @Callable(i)
11921232 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1193- let $t04810448261 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1194- let emitAmountEstimated = $t04810448261._1
1195- let commonState = $t04810448261._2
1196- let feeAmount = $t04810448261._3
1197- let bonus = $t04810448261._4
1198- let paymentInAmountAsset = $t04810448261._5
1233+ let $t04913149288 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1234+ let emitAmountEstimated = $t04913149288._1
1235+ let commonState = $t04913149288._2
1236+ let feeAmount = $t04913149288._3
1237+ let bonus = $t04913149288._4
1238+ let paymentInAmountAsset = $t04913149288._5
11991239 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12001240 }
12011241
12091249 then @
12101250 else throw(($getType(@) + " couldn't be cast to Boolean"))
12111251 }
1212- let isGetDisabled = if (if (isGlobalShutdown())
1213- then true
1214- else (cfgPoolStatus == PoolShutdown))
1215- then true
1216- else isPoolOneTokenOperationsDisabled
1252+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
1253+ then if (if (isGlobalShutdown())
1254+ then true
1255+ else (cfgPoolStatus == PoolShutdown))
1256+ then true
1257+ else isPoolOneTokenOperationsDisabled
1258+ else false
12171259 let checks = [if (if (!(isGetDisabled))
12181260 then true
12191261 else isManager(i))
12321274 then {
12331275 let userAddress = i.caller
12341276 let txId = i.transactionId
1235- let $t04914649299 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1236- if (($t04914649299 == $t04914649299))
1277+ let $t05021050363 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1278+ if (($t05021050363 == $t05021050363))
12371279 then {
1238- let outInAmountAsset = $t04914649299._5
1239- let bonus = $t04914649299._4
1240- let feeAmount = $t04914649299._3
1241- let commonState = $t04914649299._2
1242- let amountEstimated = $t04914649299._1
1280+ let outInAmountAsset = $t05021050363._5
1281+ let bonus = $t05021050363._4
1282+ let feeAmount = $t05021050363._3
1283+ let commonState = $t05021050363._2
1284+ let amountEstimated = $t05021050363._1
12431285 let amount = if (if ((minOutAmount > 0))
12441286 then (minOutAmount > amountEstimated)
12451287 else false)
12531295 let sendFee = if ((feeAmount > 0))
12541296 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12551297 else nil
1256- let $t04996350210 = {
1298+ let $t05102751274 = {
12571299 let feeAmountForCalc = if ((this == feeCollectorAddress))
12581300 then 0
12591301 else feeAmount
12611303 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12621304 else $Tuple2(0, -((amount + feeAmountForCalc)))
12631305 }
1264- let amountAssetBalanceDelta = $t04996350210._1
1265- let priceAssetBalanceDelta = $t04996350210._2
1266- let $t05021350321 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1267- let refreshKLpActions = $t05021350321._1
1268- let updatedKLp = $t05021350321._2
1306+ let amountAssetBalanceDelta = $t05102751274._1
1307+ let priceAssetBalanceDelta = $t05102751274._2
1308+ let $t05127751385 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1309+ let refreshKLpActions = $t05127751385._1
1310+ let updatedKLp = $t05127751385._2
12691311 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12701312 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12711313 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
12841326
12851327 @Callable(i)
12861328 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1287- let $t05059950755 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1288- let amountEstimated = $t05059950755._1
1289- let commonState = $t05059950755._2
1290- let feeAmount = $t05059950755._3
1291- let bonus = $t05059950755._4
1292- let outInAmountAsset = $t05059950755._5
1329+ let $t05166351819 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1330+ let amountEstimated = $t05166351819._1
1331+ let commonState = $t05166351819._2
1332+ let feeAmount = $t05166351819._3
1333+ let bonus = $t05166351819._4
1334+ let outInAmountAsset = $t05166351819._5
12931335 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
12941336 }
12951337
13031345 then @
13041346 else throw(($getType(@) + " couldn't be cast to Boolean"))
13051347 }
1306- let isGetDisabled = if (if (isGlobalShutdown())
1307- then true
1308- else (cfgPoolStatus == PoolShutdown))
1309- then true
1310- else isPoolOneTokenOperationsDisabled
1348+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
1349+ then if (if (isGlobalShutdown())
1350+ then true
1351+ else (cfgPoolStatus == PoolShutdown))
1352+ then true
1353+ else isPoolOneTokenOperationsDisabled
1354+ else false
13111355 let checks = [if (if (!(isGetDisabled))
13121356 then true
13131357 else isManager(i))
13261370 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13271371 if ((unstakeInv == unstakeInv))
13281372 then {
1329- let $t05166051811 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1330- if (($t05166051811 == $t05166051811))
1373+ let $t05276152912 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1374+ if (($t05276152912 == $t05276152912))
13311375 then {
1332- let outInAmountAsset = $t05166051811._5
1333- let bonus = $t05166051811._4
1334- let feeAmount = $t05166051811._3
1335- let commonState = $t05166051811._2
1336- let amountEstimated = $t05166051811._1
1376+ let outInAmountAsset = $t05276152912._5
1377+ let bonus = $t05276152912._4
1378+ let feeAmount = $t05276152912._3
1379+ let commonState = $t05276152912._2
1380+ let amountEstimated = $t05276152912._1
13371381 let amount = if (if ((minOutAmount > 0))
13381382 then (minOutAmount > amountEstimated)
13391383 else false)
13471391 let sendFee = if ((feeAmount > 0))
13481392 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13491393 else nil
1350- let $t05247052717 = {
1394+ let $t05357153818 = {
13511395 let feeAmountForCalc = if ((this == feeCollectorAddress))
13521396 then 0
13531397 else feeAmount
13551399 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13561400 else $Tuple2(0, -((amount + feeAmountForCalc)))
13571401 }
1358- let amountAssetBalanceDelta = $t05247052717._1
1359- let priceAssetBalanceDelta = $t05247052717._2
1360- let $t05272052828 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1361- let refreshKLpActions = $t05272052828._1
1362- let updatedKLp = $t05272052828._2
1402+ let amountAssetBalanceDelta = $t05357153818._1
1403+ let priceAssetBalanceDelta = $t05357153818._2
1404+ let $t05382153929 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1405+ let refreshKLpActions = $t05382153929._1
1406+ let updatedKLp = $t05382153929._2
13631407 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13641408 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13651409 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13931437 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
13941438 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
13951439 then {
1396- let $t05392354004 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1397- let refreshKLpActions = $t05392354004._1
1398- let updatedKLp = $t05392354004._2
1440+ let $t05502455105 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1441+ let refreshKLpActions = $t05502455105._1
1442+ let updatedKLp = $t05502455105._2
13991443 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14001444 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14011445 then ((withdrawState ++ state) ++ refreshKLpActions)
14281472 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14291473 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14301474 then {
1431- let $t05509955180 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1432- let refreshKLpActions = $t05509955180._1
1433- let updatedKLp = $t05509955180._2
1475+ let $t05620056281 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1476+ let refreshKLpActions = $t05620056281._1
1477+ let updatedKLp = $t05620056281._2
14341478 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14351479 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14361480 then ((withdrawState ++ state) ++ refreshKLpActions)
14651509 let poolStatus = parseIntValue(res._9)
14661510 let state = res._10
14671511 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
1468- let checkPoolStatus = if (if (isGlobalShutdown())
1469- then true
1470- else (poolStatus == PoolShutdown))
1512+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
1513+ then if (isGlobalShutdown())
1514+ then true
1515+ else (cfgPoolStatus == PoolShutdown)
1516+ else false
1517+ let checkPoolStatus = if (isGetDisabled)
14711518 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
14721519 else true
14731520 if ((checkPoolStatus == checkPoolStatus))
14751522 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14761523 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14771524 then {
1478- let $t05645256533 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1479- let refreshKLpActions = $t05645256533._1
1480- let updatedKLp = $t05645256533._2
1525+ let $t05762957710 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1526+ let refreshKLpActions = $t05762957710._1
1527+ let updatedKLp = $t05762957710._2
14811528 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14821529 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14831530 then ((withdrawState ++ state) ++ refreshKLpActions)
14981545
14991546 @Callable(i)
15001547 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
1501- let isGetDisabled = if (isGlobalShutdown())
1502- then true
1503- else (cfgPoolStatus == PoolShutdown)
1548+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
1549+ then if (isGlobalShutdown())
1550+ then true
1551+ else (cfgPoolStatus == PoolShutdown)
1552+ else false
15041553 let checks = [if (!(isGetDisabled))
15051554 then true
15061555 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15291578 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15301579 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15311580 then {
1532- let $t05797458055 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1533- let refreshKLpActions = $t05797458055._1
1534- let updatedKLp = $t05797458055._2
1581+ let $t05918859269 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1582+ let refreshKLpActions = $t05918859269._1
1583+ let updatedKLp = $t05918859269._2
15351584 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15361585 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15371586 then ((withdrawState ++ state) ++ refreshKLpActions)
15661615 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15671616 then {
15681617 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1569- let $t05925959323 = refreshKLpInternal(0, 0, 0)
1570- let kLpUpdateActions = $t05925959323._1
1571- let updatedKLp = $t05925959323._2
1618+ let $t06047360537 = refreshKLpInternal(0, 0, 0)
1619+ let kLpUpdateActions = $t06047360537._1
1620+ let updatedKLp = $t06047360537._2
15721621 let actions = if ((kLp != updatedKLp))
15731622 then kLpUpdateActions
15741623 else throwErr("nothing to refresh")
17431792 match tx {
17441793 case order: Order =>
17451794 let matcherPub = getMatcherPubOrFail()
1746- let $t06798568102 = if (skipOrderValidation())
1795+ let $t06919969316 = if (skipOrderValidation())
17471796 then $Tuple2(true, "")
17481797 else validateMatcherOrderAllowed(order)
1749- let orderValid = $t06798568102._1
1750- let orderValidInfo = $t06798568102._2
1798+ let orderValid = $t06919969316._1
1799+ let orderValidInfo = $t06919969316._2
17511800 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17521801 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17531802 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
231+func keyAddressWhitelisted (address) = makeString(["%s%s", "whitelisted", toString(address)], SEP)
232+
233+
234+func isAddressWhitelisted (address) = valueOrElse(getBoolean(factoryContract, keyAddressWhitelisted(address)), false)
235+
236+
231237 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
232238
233239
234240 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
235241
236242
237243 func getPoolConfig () = {
238244 let amtAsset = getStringOrFail(this, aa())
239245 let priceAsset = getStringOrFail(this, pa())
240246 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
241247 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
242248 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
243249 }
244250
245251
246252 func parseAssetId (input) = if ((input == wavesString))
247253 then unit
248254 else fromBase58String(input)
249255
250256
251257 func assetIdToString (input) = if ((input == unit))
252258 then wavesString
253259 else toBase58String(value(input))
254260
255261
256262 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]))
257263
258264
259265 let poolConfigParsed = parsePoolConfig(getPoolConfig())
260266
261-let $t095299695 = poolConfigParsed
267+let $t097699935 = poolConfigParsed
262268
263-let cfgPoolAddress = $t095299695._1
269+let cfgPoolAddress = $t097699935._1
264270
265-let cfgPoolStatus = $t095299695._2
271+let cfgPoolStatus = $t097699935._2
266272
267-let cfgLpAssetId = $t095299695._3
273+let cfgLpAssetId = $t097699935._3
268274
269-let cfgAmountAssetId = $t095299695._4
275+let cfgAmountAssetId = $t097699935._4
270276
271-let cfgPriceAssetId = $t095299695._5
277+let cfgPriceAssetId = $t097699935._5
272278
273-let cfgAmountAssetDecimals = $t095299695._6
279+let cfgAmountAssetDecimals = $t097699935._6
274280
275-let cfgPriceAssetDecimals = $t095299695._7
281+let cfgPriceAssetDecimals = $t097699935._7
276282
277283 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
278284
279285
280286 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
281287
282288 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
283289
284290 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)
285291
286292
287293 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)
288294
289295
290296 func getAccBalance (assetId) = {
291297 let balanceOnPool = if ((assetId == "WAVES"))
292298 then wavesBalance(this).available
293299 else assetBalance(this, fromBase58String(assetId))
294300 let totalBalance = ((balanceOnPool + getAdditionalBalanceOrZero(assetId)) - getStakingAssetBalanceOrZero(assetId))
295301 max([0, totalBalance])
296302 }
297303
298304
299305 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
300306
301307
302308 func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
303309
304310
305311 func getRate (proxy) = {
306312 let inv = invoke(proxy, "getRate", nil, nil)
307313 if ((inv == inv))
308314 then match inv {
309315 case r: Int =>
310316 r
311317 case _ =>
312318 throwErr("proxy.getRate() unexpected value")
313319 }
314320 else throw("Strict value is not equal to itself.")
315321 }
316322
317323
318324 func deposit (assetId,amount,stakingAssetId,proxy) = {
319325 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
320326 if ((currentAdditionalBalance == currentAdditionalBalance))
321327 then {
322328 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
323329 if ((currentStakingAssetBalance == currentStakingAssetBalance))
324330 then {
325331 let asset = parseAssetId(assetId)
326332 if ((amount > 0))
327333 then {
328334 let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)])
329335 if ((depositInvoke == depositInvoke))
330336 then match depositInvoke {
331337 case receivedStakingAsset: Int =>
332338 let newAdditionalBalance = (currentAdditionalBalance + amount)
333339 let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
334340 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
335341 case _ =>
336342 nil
337343 }
338344 else throw("Strict value is not equal to itself.")
339345 }
340346 else nil
341347 }
342348 else throw("Strict value is not equal to itself.")
343349 }
344350 else throw("Strict value is not equal to itself.")
345351 }
346352
347353
348354 func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = {
349355 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
350356 if ((currentAdditionalBalance == currentAdditionalBalance))
351357 then {
352358 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
353359 if ((currentStakingAssetBalance == currentStakingAssetBalance))
354360 then {
355361 let currentProxyRate = getRate(proxy)
356362 if ((currentProxyRate == currentProxyRate))
357363 then {
358364 let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance)
359365 let stakingAsset = parseAssetId(stakingAssetId)
360366 let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate)
361367 let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
362368 let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)])
363369 if ((sendStakingAssetAmount > 0))
364370 then {
365371 let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
366372 if ((withdrawInvoke == withdrawInvoke))
367373 then match withdrawInvoke {
368374 case receivedAssets: Int =>
369375 let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
370376 let newStakingAssetBalance = ((currentStakingAssetBalance - sendStakingAssetAmount) - profitAmount)
371377 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(stakingAssetId))]
372378 case _ =>
373379 nil
374380 }
375381 else throw("Strict value is not equal to itself.")
376382 }
377383 else nil
378384 }
379385 else throw("Strict value is not equal to itself.")
380386 }
381387 else throw("Strict value is not equal to itself.")
382388 }
383389 else throw("Strict value is not equal to itself.")
384390 }
385391
386392
387393 func getLeaseProxyConfig (assetId) = match invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil) {
388394 case a: (Boolean, Int, Int, String, String, Int, String) =>
389395 a
390396 case _ =>
391397 throwErr((("[" + assetId) + "] getLeaseProxyConfig() error"))
392398 }
393399
394400
395401 func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
396402 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
397403 if ((currentAdditionalBalance == currentAdditionalBalance))
398404 then {
399405 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
400406 if ((currentStakingAssetBalance == currentStakingAssetBalance))
401407 then {
402408 let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)])
403409 let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100)
404410 let diff = (currentAdditionalBalance - targetAdditionalBalance)
405411 if ((diff == 0))
406412 then nil
407413 else if ((0 > diff))
408414 then {
409415 let sendAssetAmount = -(diff)
410416 deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
411417 }
412418 else {
413419 let getAssetAmount = diff
414420 withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
415421 }
416422 }
417423 else throw("Strict value is not equal to itself.")
418424 }
419425 else throw("Strict value is not equal to itself.")
420426 }
421427
422428
423429 func rebalanceAsset (assetId) = {
424- let $t01593116067 = getLeaseProxyConfig(assetId)
425- let isLeasable = $t01593116067._1
426- let leasedRatio = $t01593116067._2
427- let minBalance = $t01593116067._3
428- let proxyAddress = $t01593116067._4
429- let proxyAssetId = $t01593116067._5
430- let proxyRateMul = $t01593116067._6
431- let stakingProfitAddress = $t01593116067._7
430+ let $t01617116307 = getLeaseProxyConfig(assetId)
431+ let isLeasable = $t01617116307._1
432+ let leasedRatio = $t01617116307._2
433+ let minBalance = $t01617116307._3
434+ let proxyAddress = $t01617116307._4
435+ let proxyAssetId = $t01617116307._5
436+ let proxyRateMul = $t01617116307._6
437+ let stakingProfitAddress = $t01617116307._7
432438 if (isLeasable)
433439 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
434440 else nil
435441 }
436442
437443
438444 func withdrawAndRebalanceAsset (assetId,getAmount) = {
439- let $t01646616602 = getLeaseProxyConfig(assetId)
440- let isLeasable = $t01646616602._1
441- let leasedRatio = $t01646616602._2
442- let minBalance = $t01646616602._3
443- let proxyAddress = $t01646616602._4
444- let proxyAssetId = $t01646616602._5
445- let proxyRateMul = $t01646616602._6
446- let stakingProfitAddress = $t01646616602._7
445+ let $t01670616842 = getLeaseProxyConfig(assetId)
446+ let isLeasable = $t01670616842._1
447+ let leasedRatio = $t01670616842._2
448+ let minBalance = $t01670616842._3
449+ let proxyAddress = $t01670616842._4
450+ let proxyAssetId = $t01670616842._5
451+ let proxyRateMul = $t01670616842._6
452+ let stakingProfitAddress = $t01670616842._7
447453 if (isLeasable)
448454 then {
449455 let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
450456 if ((newTotalLeasableBalance == newTotalLeasableBalance))
451457 then {
452458 let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
453459 if ((newAdditionalBalance == newAdditionalBalance))
454460 then {
455461 let withdrawAmount = (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)
456462 if ((withdrawAmount == withdrawAmount))
457463 then if ((0 > withdrawAmount))
458464 then deposit(assetId, -(withdrawAmount), proxyAssetId, addressFromStringValue(proxyAddress))
459465 else withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
460466 else throw("Strict value is not equal to itself.")
461467 }
462468 else throw("Strict value is not equal to itself.")
463469 }
464470 else throw("Strict value is not equal to itself.")
465471 }
466472 else nil
467473 }
468474
469475
470476 func withdrawAndRebalanceAll (amountAssetOutAmount,priceAssetOutAmount) = {
471477 let AmAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, aa()), amountAssetOutAmount)
472478 let PrAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, pa()), priceAssetOutAmount)
473479 (AmAmtWithdrawState ++ PrAmtWithdrawState)
474480 }
475481
476482
477483 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
478484 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
479485 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
480486 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
481487 }
482488
483489
484490 func calcPrices (amAmt,prAmt,lpAmt) = {
485491 let cfg = getPoolConfig()
486492 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
487493 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
488494 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
489495 let amAmtX18 = toX18(amAmt, amtAssetDcm)
490496 let prAmtX18 = toX18(prAmt, priceAssetDcm)
491497 let lpAmtX18 = toX18(lpAmt, scale8)
492498 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
493499 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
494500 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
495501 }
496502
497503
498504 func calculatePrices (amAmt,prAmt,lpAmt) = {
499505 let prices = calcPrices(amAmt, prAmt, lpAmt)
500506 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
501507 }
502508
503509
504510 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
505511 let cfg = getPoolConfig()
506512 let lpAssetId = cfg[idxPoolLPAssetId]
507513 let amAssetId = cfg[idxAmtAssetId]
508514 let prAssetId = cfg[idxPriceAssetId]
509515 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
510516 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
511517 let poolStatus = cfg[idxPoolStatus]
512518 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
513519 if ((lpAssetId != pmtAssetId))
514520 then throw("Invalid asset passed.")
515521 else {
516522 let amBalance = getAccBalance(amAssetId)
517523 let amBalanceX18 = toX18(amBalance, amAssetDcm)
518524 let prBalance = getAccBalance(prAssetId)
519525 let prBalanceX18 = toX18(prBalance, prAssetDcm)
520526 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
521527 let curPrice = fromX18(curPriceX18, scale8)
522528 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
523529 let lpEmissionX18 = toX18(lpEmission, scale8)
524530 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
525531 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
526532 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
527533 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
528534 let state = if ((txId58 == ""))
529535 then nil
530536 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
531537 then unit
532538 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
533539 then unit
534540 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)]
535541 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
536542 }
537543 }
538544
539545
540546 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
541547 let cfg = getPoolConfig()
542548 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
543549 let amAssetIdStr = cfg[idxAmtAssetId]
544550 let prAssetIdStr = cfg[idxPriceAssetId]
545551 let iAmtAssetId = cfg[idxIAmtAssetId]
546552 let iPriceAssetId = cfg[idxIPriceAssetId]
547553 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
548554 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
549555 let poolStatus = cfg[idxPoolStatus]
550556 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
551557 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
552558 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
553559 if (if ((amAssetIdStr != inAmAssetIdStr))
554560 then true
555561 else (prAssetIdStr != inPrAssetIdStr))
556562 then throw("Invalid amt or price asset passed.")
557563 else {
558564 let amBalance = if (isEvaluate)
559565 then getAccBalance(amAssetIdStr)
560566 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
561567 let prBalance = if (isEvaluate)
562568 then getAccBalance(prAssetIdStr)
563569 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
564570 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
565571 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
566572 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
567573 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
568574 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
569575 let res = if ((lpEmission == 0))
570576 then {
571577 let curPriceX18 = zeroBigInt
572578 let slippageX18 = zeroBigInt
573579 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
574580 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
575581 }
576582 else {
577583 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
578584 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
579585 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
580586 if (if ((curPriceX18 != zeroBigInt))
581587 then (slippageX18 > slippageToleranceX18)
582588 else false)
583589 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
584590 else {
585591 let lpEmissionX18 = toX18(lpEmission, scale8)
586592 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
587593 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
588594 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
589595 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
590596 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
591597 let expAmtAssetAmtX18 = expectedAmts._1
592598 let expPriceAssetAmtX18 = expectedAmts._2
593599 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
594600 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
595601 }
596602 }
597603 let calcLpAmt = res._1
598604 let calcAmAssetPmt = res._2
599605 let calcPrAssetPmt = res._3
600606 let curPrice = fromX18(res._4, scale8)
601607 let slippageCalc = fromX18(res._5, scale8)
602608 if ((0 >= calcLpAmt))
603609 then throw("Invalid calculations. LP calculated is less than zero.")
604610 else {
605611 let emitLpAmt = if (!(emitLp))
606612 then 0
607613 else calcLpAmt
608614 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
609615 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
610616 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))]
611617 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
612618 }
613619 }
614620 }
615621
616622
617623 func calcKLp (amountBalance,priceBalance,lpEmission) = {
618624 let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals))
619625 let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))
620626 let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
621627 if ((lpEmission == big0))
622628 then big0
623629 else updatedKLp
624630 }
625631
626632
627633 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
628634 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
629635 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
630636 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
631637 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
632638 currentKLp
633639 }
634640
635641
636642 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
637643 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
638644 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
639645 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
640646 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
641647 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
642648 $Tuple2(actions, updatedKLp)
643649 }
644650
645651
646652 func skipOrderValidation () = valueOrElse(getBoolean(factoryContract, keySkipOrderValidation(toString(this))), false)
647653
648654
649655 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
650656 then true
651657 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
652658
653659
654660 func validateMatcherOrderAllowed (order) = {
655661 let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
656662 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
657663 let amountAssetAmount = order.amount
658664 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
659- let $t02899129203 = if ((order.orderType == Buy))
665+ let $t02923129443 = if ((order.orderType == Buy))
660666 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
661667 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
662- let amountAssetBalanceDelta = $t02899129203._1
663- let priceAssetBalanceDelta = $t02899129203._2
668+ let amountAssetBalanceDelta = $t02923129443._1
669+ let priceAssetBalanceDelta = $t02923129443._2
664670 if (if (if (isGlobalShutdown())
665671 then true
666672 else (cfgPoolStatus == PoolMatcherDisabled))
667673 then true
668674 else (cfgPoolStatus == PoolShutdown))
669675 then throw("Exchange operations disabled")
670676 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
671677 then true
672678 else (order.assetPair.priceAsset != cfgPriceAssetId))
673679 then throw("Wrong order assets.")
674680 else {
675681 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
676- let $t02964329743 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
677- let unusedActions = $t02964329743._1
678- let kLpNew = $t02964329743._2
682+ let $t02988329983 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
683+ let unusedActions = $t02988329983._1
684+ let kLpNew = $t02988329983._2
679685 let isOrderValid = (kLpNew >= kLp)
680686 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
681687 $Tuple2(isOrderValid, info)
682688 }
683689 }
684690
685691
686692 func commonGet (i) = if ((size(i.payments) != 1))
687693 then throw("exactly 1 payment is expected")
688694 else {
689695 let pmt = value(i.payments[0])
690696 let pmtAssetId = value(pmt.assetId)
691697 let pmtAmt = pmt.amount
692698 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
693699 let outAmAmt = res._1
694700 let outPrAmt = res._2
695- let poolStatus = parseIntValue(res._9)
696701 let state = res._10
697- if (if (isGlobalShutdown())
698- then true
699- else (poolStatus == PoolShutdown))
700- then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
702+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
703+ then if (isGlobalShutdown())
704+ then true
705+ else (cfgPoolStatus == PoolShutdown)
706+ else false
707+ if (isGetDisabled)
708+ then throw(("Get operation is blocked by admin. Status = " + toString(cfgPoolStatus)))
701709 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
702710 }
703711
704712
705713 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
706714 then throw("exactly 2 payments are expected")
707715 else {
708716 let amAssetPmt = value(i.payments[0])
709717 let prAssetPmt = value(i.payments[1])
710718 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
711- let poolStatus = parseIntValue(estPut._8)
712- if (if (if (isGlobalShutdown())
713- then true
714- else (poolStatus == PoolPutDisabled))
715- then true
716- else (poolStatus == PoolShutdown))
717- then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
719+ let isPutDisabled = if (!(isAddressWhitelisted(i.caller)))
720+ then if (if (isGlobalShutdown())
721+ then true
722+ else (cfgPoolStatus == PoolPutDisabled))
723+ then true
724+ else (cfgPoolStatus == PoolShutdown)
725+ else false
726+ if (isPutDisabled)
727+ then throw(("Put operation is blocked by admin. Status = " + toString(cfgPoolStatus)))
718728 else estPut
719729 }
720730
721731
722732 func emit (amount) = {
723733 let emitInv = invoke(factoryContract, "emit", [amount], nil)
724734 if ((emitInv == emitInv))
725735 then {
726736 let emitInvLegacy = match emitInv {
727737 case legacyFactoryContract: Address =>
728738 invoke(legacyFactoryContract, "emit", [amount], nil)
729739 case _ =>
730740 unit
731741 }
732742 if ((emitInvLegacy == emitInvLegacy))
733743 then amount
734744 else throw("Strict value is not equal to itself.")
735745 }
736746 else throw("Strict value is not equal to itself.")
737747 }
738748
739749
740750 func takeFee (amount,fee) = {
741751 let feeAmount = if ((fee == 0))
742752 then 0
743753 else fraction(amount, fee, scale8)
744754 $Tuple2((amount - feeAmount), feeAmount)
745755 }
746756
747757
748758 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
749759 let isEval = (txId == unit)
750760 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
751761 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
752762 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
753763 then true
754764 else if ((paymentAssetId == cfgPriceAssetId))
755765 then false
756766 else throwErr("invalid asset")
757- let $t03285633149 = if (isEval)
767+ let $t03316933462 = if (isEval)
758768 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
759769 else if (paymentInAmountAsset)
760770 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
761771 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
762- let amountBalanceOld = $t03285633149._1
763- let priceBalanceOld = $t03285633149._2
764- let $t03315333302 = if (paymentInAmountAsset)
772+ let amountBalanceOld = $t03316933462._1
773+ let priceBalanceOld = $t03316933462._2
774+ let $t03346633615 = if (paymentInAmountAsset)
765775 then $Tuple2(paymentAmountRaw, 0)
766776 else $Tuple2(0, paymentAmountRaw)
767- let amountAssetAmountRaw = $t03315333302._1
768- let priceAssetAmountRaw = $t03315333302._2
777+ let amountAssetAmountRaw = $t03346633615._1
778+ let priceAssetAmountRaw = $t03346633615._2
769779 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
770780 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
771- let $t03343433498 = takeFee(paymentAmountRaw, inFee)
772- let paymentAmount = $t03343433498._1
773- let feeAmount = $t03343433498._2
781+ let $t03374733811 = takeFee(paymentAmountRaw, inFee)
782+ let paymentAmount = $t03374733811._1
783+ let feeAmount = $t03374733811._2
774784 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
775785 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
776786 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
777787 let priceNew = fromX18(priceNewX18, scale8)
778788 let paymentBalance = if (paymentInAmountAsset)
779789 then amountBalanceOld
780790 else priceBalanceOld
781791 let paymentBalanceBigInt = toBigInt(paymentBalance)
782792 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
783793 let chechSupply = if ((supplyBigInt > big0))
784794 then true
785795 else throwErr("initial deposit requires all coins")
786796 if ((chechSupply == chechSupply))
787797 then {
788798 let depositBigInt = toBigInt(paymentAmount)
789799 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
790800 let commonState = if (isEval)
791801 then nil
792802 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))]
793803 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
794804 let priceOld = fromX18(priceOldX18, scale8)
795805 let loss = {
796- let $t03517935346 = if (paymentInAmountAsset)
806+ let $t03549235659 = if (paymentInAmountAsset)
797807 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
798808 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
799- let amount = $t03517935346._1
800- let balance = $t03517935346._2
809+ let amount = $t03549235659._1
810+ let balance = $t03549235659._2
801811 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
802812 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
803813 }
804814 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
805815 }
806816 else throw("Strict value is not equal to itself.")
807817 }
808818
809819
810820 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
811821 let isEval = (txId == unit)
812822 let cfg = getPoolConfig()
813823 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
814824 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
815825 let checks = [if ((paymentAssetId == cfgLpAssetId))
816826 then true
817827 else throwErr("invalid lp asset")]
818828 if ((checks == checks))
819829 then {
820830 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
821831 then true
822832 else if ((outAssetId == cfgPriceAssetId))
823833 then false
824834 else throwErr("invalid asset")
825835 let balanceBigInt = if (outInAmountAsset)
826836 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
827837 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
828838 let outInAmountAssetDecimals = if (outInAmountAsset)
829839 then amtAssetDcm
830840 else priceAssetDcm
831841 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
832842 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
833843 let outBalance = if (outInAmountAsset)
834844 then amBalanceOld
835845 else prBalanceOld
836846 let outBalanceBigInt = toBigInt(outBalance)
837847 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
838848 let redeemedBigInt = toBigInt(paymentAmount)
839849 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
840- let $t03742437480 = takeFee(amountRaw, outFee)
841- let totalAmount = $t03742437480._1
842- let feeAmount = $t03742437480._2
843- let $t03748437710 = if (outInAmountAsset)
850+ let $t03773737793 = takeFee(amountRaw, outFee)
851+ let totalAmount = $t03773737793._1
852+ let feeAmount = $t03773737793._2
853+ let $t03779738023 = if (outInAmountAsset)
844854 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
845855 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
846- let outAmAmount = $t03748437710._1
847- let outPrAmount = $t03748437710._2
848- let amBalanceNew = $t03748437710._3
849- let prBalanceNew = $t03748437710._4
856+ let outAmAmount = $t03779738023._1
857+ let outPrAmount = $t03779738023._2
858+ let amBalanceNew = $t03779738023._3
859+ let prBalanceNew = $t03779738023._4
850860 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
851861 let priceNew = fromX18(priceNewX18, scale8)
852862 let commonState = if (isEval)
853863 then nil
854864 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)]
855865 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
856866 let priceOld = fromX18(priceOldX18, scale8)
857867 let loss = {
858868 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
859869 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
860870 }
861871 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
862872 }
863873 else throw("Strict value is not equal to itself.")
864874 }
865875
866876
867877 func managerPublicKeyOrUnit () = {
868878 let managerVaultAddress = getManagerVaultAddressOrThis()
869879 match getString(managerVaultAddress, keyManagerPublicKey()) {
870880 case s: String =>
871881 fromBase58String(s)
872882 case _: Unit =>
873883 unit
874884 case _ =>
875885 throw("Match error")
876886 }
877887 }
878888
879889
880890 func isManager (i) = match managerPublicKeyOrUnit() {
881891 case pk: ByteVector =>
882892 (i.callerPublicKey == pk)
883893 case _: Unit =>
884894 (i.caller == this)
885895 case _ =>
886896 throw("Match error")
887897 }
888898
889899
890900 func mustManager (i) = {
891901 let pd = throw("Permission denied")
892902 match managerPublicKeyOrUnit() {
893903 case pk: ByteVector =>
894904 if ((i.callerPublicKey == pk))
895905 then true
896906 else pd
897907 case _: Unit =>
898908 if ((i.caller == this))
899909 then true
900910 else pd
901911 case _ =>
902912 throw("Match error")
903913 }
904914 }
905915
906916
907917 @Callable(i)
908918 func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa())))
909919
910920
911921
912922 @Callable(i)
913923 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
914- let $t03956839873 = if ((isReverse == false))
924+ let $t03988140186 = if ((isReverse == false))
915925 then {
916926 let assetOut = getStringOrFail(this, pa())
917927 let assetIn = getStringOrFail(this, aa())
918928 $Tuple2(assetOut, assetIn)
919929 }
920930 else {
921931 let assetOut = getStringOrFail(this, aa())
922932 let assetIn = getStringOrFail(this, pa())
923933 $Tuple2(assetOut, assetIn)
924934 }
925- let assetOut = $t03956839873._1
926- let assetIn = $t03956839873._2
935+ let assetOut = $t03988140186._1
936+ let assetIn = $t03988140186._2
927937 let poolAssetInBalance = getAccBalance(assetIn)
928938 let poolAssetOutBalance = getAccBalance(assetOut)
929939 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
930940 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
931941 let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
932942 let checkK = if ((newK >= oldK))
933943 then true
934944 else throw("new K is fewer error")
935945 if ((checkK == checkK))
936946 then $Tuple2(nil, amountOut)
937947 else throw("Strict value is not equal to itself.")
938948 }
939949
940950
941951
942952 @Callable(i)
943953 func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = {
944954 let swapContact = {
945955 let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil)
946956 if ($isInstanceOf(@, "String"))
947957 then @
948958 else throw(($getType(@) + " couldn't be cast to String"))
949959 }
950- let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
960+ let isPoolSwapDisabled = {
961+ let @ = invoke(factoryContract, "isPoolSwapDisabledREADONLY", [toString(this)], nil)
962+ if ($isInstanceOf(@, "Boolean"))
963+ then @
964+ else throw(($getType(@) + " couldn't be cast to Boolean"))
965+ }
966+ let isSwapDisabled = if (!(isAddressWhitelisted(i.caller)))
967+ then if (if (isGlobalShutdown())
968+ then true
969+ else (cfgPoolStatus == PoolShutdown))
970+ then true
971+ else isPoolSwapDisabled
972+ else false
973+ let checks = [if (if (!(isSwapDisabled))
974+ then true
975+ else isManager(i))
976+ then true
977+ else throwErr("swap operation is blocked by admin"), if ((value(i.payments[0]).amount >= cleanAmountIn))
951978 then true
952979 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
953980 then true
954981 else throwErr("Permission denied")]
955982 if ((checks == checks))
956983 then {
957984 let pmt = value(i.payments[0])
958985 let assetIn = assetIdToString(pmt.assetId)
959986 let assetOut = if ((isReverse == false))
960987 then getStringOrFail(this, pa())
961988 else getStringOrFail(this, aa())
962989 let poolAssetInBalance = ((getAccBalance(assetIn) - value(i.payments[0]).amount) - feePoolAmount)
963990 let poolAssetOutBalance = getAccBalance(assetOut)
964991 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
965992 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
966993 let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
967994 let checkK = if ((newK >= oldK))
968995 then true
969996 else throw("new K is fewer error")
970997 if ((checkK == checkK))
971998 then {
972999 let checkMin = if ((amountOut >= amountOutMin))
9731000 then true
9741001 else throw("Exchange result is fewer coins than expected")
9751002 if ((checkMin == checkMin))
9761003 then {
977- let rebalanceState = rebalanceAsset(assetIn)
978- if ((rebalanceState == rebalanceState))
1004+ let amountAssetBalanceDelta = if (isReverse)
1005+ then -(amountOut)
1006+ else feePoolAmount
1007+ let priceAssetBalanceDelta = if (isReverse)
1008+ then feePoolAmount
1009+ else -(amountOut)
1010+ let refreshKLpActions = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)._1
1011+ if ((refreshKLpActions == refreshKLpActions))
9791012 then {
980- let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
981- if ((withdrawState == withdrawState))
982- then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
1013+ let rebalanceState = rebalanceAsset(assetIn)
1014+ if ((rebalanceState == rebalanceState))
1015+ then {
1016+ let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
1017+ if ((withdrawState == withdrawState))
1018+ then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
1019+ else throw("Strict value is not equal to itself.")
1020+ }
9831021 else throw("Strict value is not equal to itself.")
9841022 }
9851023 else throw("Strict value is not equal to itself.")
9861024 }
9871025 else throw("Strict value is not equal to itself.")
9881026 }
9891027 else throw("Strict value is not equal to itself.")
9901028 }
9911029 else throw("Strict value is not equal to itself.")
9921030 }
9931031
9941032
9951033
9961034 @Callable(i)
9971035 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
9981036 then throw("Invalid slippageTolerance passed")
9991037 else {
10001038 let estPut = commonPut(i, slippageTolerance, true)
10011039 let emitLpAmt = estPut._2
10021040 let lpAssetId = estPut._7
10031041 let state = estPut._9
10041042 let amDiff = estPut._10
10051043 let prDiff = estPut._11
10061044 let amId = estPut._12
10071045 let prId = estPut._13
10081046 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10091047 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10101048 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10111049 if ((currentKLp == currentKLp))
10121050 then {
10131051 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
10141052 if ((emitInv == emitInv))
10151053 then {
10161054 let emitInvLegacy = match emitInv {
10171055 case legacyFactoryContract: Address =>
10181056 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
10191057 case _ =>
10201058 unit
10211059 }
10221060 if ((emitInvLegacy == emitInvLegacy))
10231061 then {
10241062 let slippageAInv = if ((amDiff > 0))
10251063 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
10261064 else nil
10271065 if ((slippageAInv == slippageAInv))
10281066 then {
10291067 let slippagePInv = if ((prDiff > 0))
10301068 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
10311069 else nil
10321070 if ((slippagePInv == slippagePInv))
10331071 then {
10341072 let lpTransfer = if (shouldAutoStake)
10351073 then {
10361074 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
10371075 if ((slpStakeInv == slpStakeInv))
10381076 then nil
10391077 else throw("Strict value is not equal to itself.")
10401078 }
10411079 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1042- let $t04437644838 = refreshKLpInternal(0, 0, 0)
1043- if (($t04437644838 == $t04437644838))
1080+ let $t04536245824 = refreshKLpInternal(0, 0, 0)
1081+ if (($t04536245824 == $t04536245824))
10441082 then {
1045- let updatedKLp = $t04437644838._2
1046- let refreshKLpActions = $t04437644838._1
1083+ let updatedKLp = $t04536245824._2
1084+ let refreshKLpActions = $t04536245824._1
10471085 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10481086 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10491087 then {
10501088 let reb = invoke(this, "rebalance", nil, nil)
10511089 if ((reb == reb))
10521090 then ((state ++ lpTransfer) ++ refreshKLpActions)
10531091 else throw("Strict value is not equal to itself.")
10541092 }
10551093 else throw("Strict value is not equal to itself.")
10561094 }
10571095 else throw("Strict value is not equal to itself.")
10581096 }
10591097 else throw("Strict value is not equal to itself.")
10601098 }
10611099 else throw("Strict value is not equal to itself.")
10621100 }
10631101 else throw("Strict value is not equal to itself.")
10641102 }
10651103 else throw("Strict value is not equal to itself.")
10661104 }
10671105 else throw("Strict value is not equal to itself.")
10681106 }
10691107
10701108
10711109
10721110 @Callable(i)
10731111 func putForFree (maxSlippage) = if ((0 > maxSlippage))
10741112 then throw("Invalid value passed")
10751113 else {
10761114 let estPut = commonPut(i, maxSlippage, false)
10771115 let state = estPut._9
10781116 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10791117 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10801118 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10811119 if ((currentKLp == currentKLp))
10821120 then {
1083- let $t04545045515 = refreshKLpInternal(0, 0, 0)
1084- let refreshKLpActions = $t04545045515._1
1085- let updatedKLp = $t04545045515._2
1121+ let $t04643646501 = refreshKLpInternal(0, 0, 0)
1122+ let refreshKLpActions = $t04643646501._1
1123+ let updatedKLp = $t04643646501._2
10861124 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10871125 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10881126 then (state ++ refreshKLpActions)
10891127 else throw("Strict value is not equal to itself.")
10901128 }
10911129 else throw("Strict value is not equal to itself.")
10921130 }
10931131
10941132
10951133
10961134 @Callable(i)
10971135 func putOneTkn (minOutAmount,autoStake) = {
10981136 let isPoolOneTokenOperationsDisabled = {
10991137 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11001138 if ($isInstanceOf(@, "Boolean"))
11011139 then @
11021140 else throw(($getType(@) + " couldn't be cast to Boolean"))
11031141 }
1104- let isPutDisabled = if (if (if (isGlobalShutdown())
1105- then true
1106- else (cfgPoolStatus == PoolPutDisabled))
1107- then true
1108- else (cfgPoolStatus == PoolShutdown))
1109- then true
1110- else isPoolOneTokenOperationsDisabled
1142+ let isPutDisabled = if (!(isAddressWhitelisted(i.caller)))
1143+ then if (if (if (isGlobalShutdown())
1144+ then true
1145+ else (cfgPoolStatus == PoolPutDisabled))
1146+ then true
1147+ else (cfgPoolStatus == PoolShutdown))
1148+ then true
1149+ else isPoolOneTokenOperationsDisabled
1150+ else false
11111151 let checks = [if (if (!(isPutDisabled))
11121152 then true
11131153 else isManager(i))
11141154 then true
11151155 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
11161156 then true
11171157 else throwErr("exactly 1 payment are expected")]
11181158 if ((checks == checks))
11191159 then {
11201160 let payment = i.payments[0]
11211161 let paymentAssetId = payment.assetId
11221162 let paymentAmountRaw = payment.amount
11231163 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
11241164 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
11251165 else if ((paymentAssetId == cfgPriceAssetId))
11261166 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
11271167 else throwErr("payment asset is not supported")
11281168 if ((currentKLp == currentKLp))
11291169 then {
11301170 let userAddress = i.caller
11311171 let txId = i.transactionId
1132- let $t04670346855 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1133- if (($t04670346855 == $t04670346855))
1172+ let $t04773047882 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1173+ if (($t04773047882 == $t04773047882))
11341174 then {
1135- let paymentInAmountAsset = $t04670346855._5
1136- let bonus = $t04670346855._4
1137- let feeAmount = $t04670346855._3
1138- let commonState = $t04670346855._2
1139- let emitAmountEstimated = $t04670346855._1
1175+ let paymentInAmountAsset = $t04773047882._5
1176+ let bonus = $t04773047882._4
1177+ let feeAmount = $t04773047882._3
1178+ let commonState = $t04773047882._2
1179+ let emitAmountEstimated = $t04773047882._1
11401180 let emitAmount = if (if ((minOutAmount > 0))
11411181 then (minOutAmount > emitAmountEstimated)
11421182 else false)
11431183 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
11441184 else emitAmountEstimated
11451185 let emitInv = emit(emitAmount)
11461186 if ((emitInv == emitInv))
11471187 then {
11481188 let lpTransfer = if (autoStake)
11491189 then {
11501190 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
11511191 if ((stakeInv == stakeInv))
11521192 then nil
11531193 else throw("Strict value is not equal to itself.")
11541194 }
11551195 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
11561196 let sendFee = if ((feeAmount > 0))
11571197 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11581198 else nil
1159- let $t04744147638 = if ((this == feeCollectorAddress))
1199+ let $t04846848665 = if ((this == feeCollectorAddress))
11601200 then $Tuple2(0, 0)
11611201 else if (paymentInAmountAsset)
11621202 then $Tuple2(-(feeAmount), 0)
11631203 else $Tuple2(0, -(feeAmount))
1164- let amountAssetBalanceDelta = $t04744147638._1
1165- let priceAssetBalanceDelta = $t04744147638._2
1166- let $t04764147749 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1167- let refreshKLpActions = $t04764147749._1
1168- let updatedKLp = $t04764147749._2
1204+ let amountAssetBalanceDelta = $t04846848665._1
1205+ let priceAssetBalanceDelta = $t04846848665._2
1206+ let $t04866848776 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1207+ let refreshKLpActions = $t04866848776._1
1208+ let updatedKLp = $t04866848776._2
11691209 let kLp = value(getString(keyKLp))
11701210 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11711211 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11721212 then {
11731213 let reb = invoke(this, "rebalance", nil, nil)
11741214 if ((reb == reb))
11751215 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
11761216 else throw("Strict value is not equal to itself.")
11771217 }
11781218 else throw("Strict value is not equal to itself.")
11791219 }
11801220 else throw("Strict value is not equal to itself.")
11811221 }
11821222 else throw("Strict value is not equal to itself.")
11831223 }
11841224 else throw("Strict value is not equal to itself.")
11851225 }
11861226 else throw("Strict value is not equal to itself.")
11871227 }
11881228
11891229
11901230
11911231 @Callable(i)
11921232 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1193- let $t04810448261 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1194- let emitAmountEstimated = $t04810448261._1
1195- let commonState = $t04810448261._2
1196- let feeAmount = $t04810448261._3
1197- let bonus = $t04810448261._4
1198- let paymentInAmountAsset = $t04810448261._5
1233+ let $t04913149288 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1234+ let emitAmountEstimated = $t04913149288._1
1235+ let commonState = $t04913149288._2
1236+ let feeAmount = $t04913149288._3
1237+ let bonus = $t04913149288._4
1238+ let paymentInAmountAsset = $t04913149288._5
11991239 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12001240 }
12011241
12021242
12031243
12041244 @Callable(i)
12051245 func getOneTkn (outAssetIdStr,minOutAmount) = {
12061246 let isPoolOneTokenOperationsDisabled = {
12071247 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12081248 if ($isInstanceOf(@, "Boolean"))
12091249 then @
12101250 else throw(($getType(@) + " couldn't be cast to Boolean"))
12111251 }
1212- let isGetDisabled = if (if (isGlobalShutdown())
1213- then true
1214- else (cfgPoolStatus == PoolShutdown))
1215- then true
1216- else isPoolOneTokenOperationsDisabled
1252+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
1253+ then if (if (isGlobalShutdown())
1254+ then true
1255+ else (cfgPoolStatus == PoolShutdown))
1256+ then true
1257+ else isPoolOneTokenOperationsDisabled
1258+ else false
12171259 let checks = [if (if (!(isGetDisabled))
12181260 then true
12191261 else isManager(i))
12201262 then true
12211263 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
12221264 then true
12231265 else throwErr("exactly 1 payment are expected")]
12241266 if ((checks == checks))
12251267 then {
12261268 let outAssetId = parseAssetId(outAssetIdStr)
12271269 let payment = i.payments[0]
12281270 let paymentAssetId = payment.assetId
12291271 let paymentAmount = payment.amount
12301272 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12311273 if ((currentKLp == currentKLp))
12321274 then {
12331275 let userAddress = i.caller
12341276 let txId = i.transactionId
1235- let $t04914649299 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1236- if (($t04914649299 == $t04914649299))
1277+ let $t05021050363 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1278+ if (($t05021050363 == $t05021050363))
12371279 then {
1238- let outInAmountAsset = $t04914649299._5
1239- let bonus = $t04914649299._4
1240- let feeAmount = $t04914649299._3
1241- let commonState = $t04914649299._2
1242- let amountEstimated = $t04914649299._1
1280+ let outInAmountAsset = $t05021050363._5
1281+ let bonus = $t05021050363._4
1282+ let feeAmount = $t05021050363._3
1283+ let commonState = $t05021050363._2
1284+ let amountEstimated = $t05021050363._1
12431285 let amount = if (if ((minOutAmount > 0))
12441286 then (minOutAmount > amountEstimated)
12451287 else false)
12461288 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
12471289 else amountEstimated
12481290 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
12491291 if ((burnInv == burnInv))
12501292 then {
12511293 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
12521294 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
12531295 let sendFee = if ((feeAmount > 0))
12541296 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12551297 else nil
1256- let $t04996350210 = {
1298+ let $t05102751274 = {
12571299 let feeAmountForCalc = if ((this == feeCollectorAddress))
12581300 then 0
12591301 else feeAmount
12601302 if (outInAmountAsset)
12611303 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12621304 else $Tuple2(0, -((amount + feeAmountForCalc)))
12631305 }
1264- let amountAssetBalanceDelta = $t04996350210._1
1265- let priceAssetBalanceDelta = $t04996350210._2
1266- let $t05021350321 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1267- let refreshKLpActions = $t05021350321._1
1268- let updatedKLp = $t05021350321._2
1306+ let amountAssetBalanceDelta = $t05102751274._1
1307+ let priceAssetBalanceDelta = $t05102751274._2
1308+ let $t05127751385 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1309+ let refreshKLpActions = $t05127751385._1
1310+ let updatedKLp = $t05127751385._2
12691311 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12701312 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12711313 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
12721314 else throw("Strict value is not equal to itself.")
12731315 }
12741316 else throw("Strict value is not equal to itself.")
12751317 }
12761318 else throw("Strict value is not equal to itself.")
12771319 }
12781320 else throw("Strict value is not equal to itself.")
12791321 }
12801322 else throw("Strict value is not equal to itself.")
12811323 }
12821324
12831325
12841326
12851327 @Callable(i)
12861328 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1287- let $t05059950755 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1288- let amountEstimated = $t05059950755._1
1289- let commonState = $t05059950755._2
1290- let feeAmount = $t05059950755._3
1291- let bonus = $t05059950755._4
1292- let outInAmountAsset = $t05059950755._5
1329+ let $t05166351819 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1330+ let amountEstimated = $t05166351819._1
1331+ let commonState = $t05166351819._2
1332+ let feeAmount = $t05166351819._3
1333+ let bonus = $t05166351819._4
1334+ let outInAmountAsset = $t05166351819._5
12931335 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
12941336 }
12951337
12961338
12971339
12981340 @Callable(i)
12991341 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
13001342 let isPoolOneTokenOperationsDisabled = {
13011343 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13021344 if ($isInstanceOf(@, "Boolean"))
13031345 then @
13041346 else throw(($getType(@) + " couldn't be cast to Boolean"))
13051347 }
1306- let isGetDisabled = if (if (isGlobalShutdown())
1307- then true
1308- else (cfgPoolStatus == PoolShutdown))
1309- then true
1310- else isPoolOneTokenOperationsDisabled
1348+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
1349+ then if (if (isGlobalShutdown())
1350+ then true
1351+ else (cfgPoolStatus == PoolShutdown))
1352+ then true
1353+ else isPoolOneTokenOperationsDisabled
1354+ else false
13111355 let checks = [if (if (!(isGetDisabled))
13121356 then true
13131357 else isManager(i))
13141358 then true
13151359 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13161360 then true
13171361 else throwErr("no payments are expected")]
13181362 if ((checks == checks))
13191363 then {
13201364 let outAssetId = parseAssetId(outAssetIdStr)
13211365 let userAddress = i.caller
13221366 let txId = i.transactionId
13231367 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13241368 if ((currentKLp == currentKLp))
13251369 then {
13261370 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13271371 if ((unstakeInv == unstakeInv))
13281372 then {
1329- let $t05166051811 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1330- if (($t05166051811 == $t05166051811))
1373+ let $t05276152912 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1374+ if (($t05276152912 == $t05276152912))
13311375 then {
1332- let outInAmountAsset = $t05166051811._5
1333- let bonus = $t05166051811._4
1334- let feeAmount = $t05166051811._3
1335- let commonState = $t05166051811._2
1336- let amountEstimated = $t05166051811._1
1376+ let outInAmountAsset = $t05276152912._5
1377+ let bonus = $t05276152912._4
1378+ let feeAmount = $t05276152912._3
1379+ let commonState = $t05276152912._2
1380+ let amountEstimated = $t05276152912._1
13371381 let amount = if (if ((minOutAmount > 0))
13381382 then (minOutAmount > amountEstimated)
13391383 else false)
13401384 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
13411385 else amountEstimated
13421386 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13431387 if ((burnInv == burnInv))
13441388 then {
13451389 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
13461390 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
13471391 let sendFee = if ((feeAmount > 0))
13481392 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13491393 else nil
1350- let $t05247052717 = {
1394+ let $t05357153818 = {
13511395 let feeAmountForCalc = if ((this == feeCollectorAddress))
13521396 then 0
13531397 else feeAmount
13541398 if (outInAmountAsset)
13551399 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13561400 else $Tuple2(0, -((amount + feeAmountForCalc)))
13571401 }
1358- let amountAssetBalanceDelta = $t05247052717._1
1359- let priceAssetBalanceDelta = $t05247052717._2
1360- let $t05272052828 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1361- let refreshKLpActions = $t05272052828._1
1362- let updatedKLp = $t05272052828._2
1402+ let amountAssetBalanceDelta = $t05357153818._1
1403+ let priceAssetBalanceDelta = $t05357153818._2
1404+ let $t05382153929 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1405+ let refreshKLpActions = $t05382153929._1
1406+ let updatedKLp = $t05382153929._2
13631407 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13641408 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13651409 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13661410 else throw("Strict value is not equal to itself.")
13671411 }
13681412 else throw("Strict value is not equal to itself.")
13691413 }
13701414 else throw("Strict value is not equal to itself.")
13711415 }
13721416 else throw("Strict value is not equal to itself.")
13731417 }
13741418 else throw("Strict value is not equal to itself.")
13751419 }
13761420 else throw("Strict value is not equal to itself.")
13771421 }
13781422
13791423
13801424
13811425 @Callable(i)
13821426 func get () = {
13831427 let res = commonGet(i)
13841428 let outAmAmt = res._1
13851429 let outPrAmt = res._2
13861430 let pmtAmt = res._3
13871431 let pmtAssetId = res._4
13881432 let state = res._5
13891433 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
13901434 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13911435 if ((currentKLp == currentKLp))
13921436 then {
13931437 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
13941438 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
13951439 then {
1396- let $t05392354004 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1397- let refreshKLpActions = $t05392354004._1
1398- let updatedKLp = $t05392354004._2
1440+ let $t05502455105 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1441+ let refreshKLpActions = $t05502455105._1
1442+ let updatedKLp = $t05502455105._2
13991443 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14001444 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14011445 then ((withdrawState ++ state) ++ refreshKLpActions)
14021446 else throw("Strict value is not equal to itself.")
14031447 }
14041448 else throw("Strict value is not equal to itself.")
14051449 }
14061450 else throw("Strict value is not equal to itself.")
14071451 }
14081452
14091453
14101454
14111455 @Callable(i)
14121456 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
14131457 let res = commonGet(i)
14141458 let outAmAmt = res._1
14151459 let outPrAmt = res._2
14161460 let pmtAmt = res._3
14171461 let pmtAssetId = res._4
14181462 let state = res._5
14191463 if ((noLessThenAmtAsset > outAmAmt))
14201464 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
14211465 else if ((noLessThenPriceAsset > outPrAmt))
14221466 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14231467 else {
14241468 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14251469 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14261470 if ((currentKLp == currentKLp))
14271471 then {
14281472 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14291473 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14301474 then {
1431- let $t05509955180 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1432- let refreshKLpActions = $t05509955180._1
1433- let updatedKLp = $t05509955180._2
1475+ let $t05620056281 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1476+ let refreshKLpActions = $t05620056281._1
1477+ let updatedKLp = $t05620056281._2
14341478 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14351479 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14361480 then ((withdrawState ++ state) ++ refreshKLpActions)
14371481 else throw("Strict value is not equal to itself.")
14381482 }
14391483 else throw("Strict value is not equal to itself.")
14401484 }
14411485 else throw("Strict value is not equal to itself.")
14421486 }
14431487 }
14441488
14451489
14461490
14471491 @Callable(i)
14481492 func unstakeAndGet (amount) = {
14491493 let checkPayments = if ((size(i.payments) != 0))
14501494 then throw("No payments are expected")
14511495 else true
14521496 if ((checkPayments == checkPayments))
14531497 then {
14541498 let cfg = getPoolConfig()
14551499 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
14561500 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14571501 if ((currentKLp == currentKLp))
14581502 then {
14591503 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
14601504 if ((unstakeInv == unstakeInv))
14611505 then {
14621506 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
14631507 let outAmAmt = res._1
14641508 let outPrAmt = res._2
14651509 let poolStatus = parseIntValue(res._9)
14661510 let state = res._10
14671511 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
1468- let checkPoolStatus = if (if (isGlobalShutdown())
1469- then true
1470- else (poolStatus == PoolShutdown))
1512+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
1513+ then if (isGlobalShutdown())
1514+ then true
1515+ else (cfgPoolStatus == PoolShutdown)
1516+ else false
1517+ let checkPoolStatus = if (isGetDisabled)
14711518 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
14721519 else true
14731520 if ((checkPoolStatus == checkPoolStatus))
14741521 then {
14751522 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14761523 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14771524 then {
1478- let $t05645256533 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1479- let refreshKLpActions = $t05645256533._1
1480- let updatedKLp = $t05645256533._2
1525+ let $t05762957710 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1526+ let refreshKLpActions = $t05762957710._1
1527+ let updatedKLp = $t05762957710._2
14811528 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14821529 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14831530 then ((withdrawState ++ state) ++ refreshKLpActions)
14841531 else throw("Strict value is not equal to itself.")
14851532 }
14861533 else throw("Strict value is not equal to itself.")
14871534 }
14881535 else throw("Strict value is not equal to itself.")
14891536 }
14901537 else throw("Strict value is not equal to itself.")
14911538 }
14921539 else throw("Strict value is not equal to itself.")
14931540 }
14941541 else throw("Strict value is not equal to itself.")
14951542 }
14961543
14971544
14981545
14991546 @Callable(i)
15001547 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
1501- let isGetDisabled = if (isGlobalShutdown())
1502- then true
1503- else (cfgPoolStatus == PoolShutdown)
1548+ let isGetDisabled = if (!(isAddressWhitelisted(i.caller)))
1549+ then if (isGlobalShutdown())
1550+ then true
1551+ else (cfgPoolStatus == PoolShutdown)
1552+ else false
15041553 let checks = [if (!(isGetDisabled))
15051554 then true
15061555 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15071556 then true
15081557 else throw("no payments are expected")]
15091558 if ((checks == checks))
15101559 then {
15111560 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15121561 if ((currentKLp == currentKLp))
15131562 then {
15141563 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
15151564 if ((unstakeInv == unstakeInv))
15161565 then {
15171566 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
15181567 let outAmAmt = res._1
15191568 let outPrAmt = res._2
15201569 let state = res._10
15211570 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
15221571 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15231572 then true
15241573 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15251574 then true
15261575 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
15271576 if ((checkAmounts == checkAmounts))
15281577 then {
15291578 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15301579 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15311580 then {
1532- let $t05797458055 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1533- let refreshKLpActions = $t05797458055._1
1534- let updatedKLp = $t05797458055._2
1581+ let $t05918859269 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1582+ let refreshKLpActions = $t05918859269._1
1583+ let updatedKLp = $t05918859269._2
15351584 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15361585 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15371586 then ((withdrawState ++ state) ++ refreshKLpActions)
15381587 else throw("Strict value is not equal to itself.")
15391588 }
15401589 else throw("Strict value is not equal to itself.")
15411590 }
15421591 else throw("Strict value is not equal to itself.")
15431592 }
15441593 else throw("Strict value is not equal to itself.")
15451594 }
15461595 else throw("Strict value is not equal to itself.")
15471596 }
15481597 else throw("Strict value is not equal to itself.")
15491598 }
15501599
15511600
15521601
15531602 @Callable(i)
15541603 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
15551604 then throw("permissions denied")
15561605 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
15571606
15581607
15591608
15601609 @Callable(i)
15611610 func refreshKLp () = {
15621611 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
15631612 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
15641613 then unit
15651614 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
15661615 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15671616 then {
15681617 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1569- let $t05925959323 = refreshKLpInternal(0, 0, 0)
1570- let kLpUpdateActions = $t05925959323._1
1571- let updatedKLp = $t05925959323._2
1618+ let $t06047360537 = refreshKLpInternal(0, 0, 0)
1619+ let kLpUpdateActions = $t06047360537._1
1620+ let updatedKLp = $t06047360537._2
15721621 let actions = if ((kLp != updatedKLp))
15731622 then kLpUpdateActions
15741623 else throwErr("nothing to refresh")
15751624 $Tuple2(actions, toString(updatedKLp))
15761625 }
15771626 else throw("Strict value is not equal to itself.")
15781627 }
15791628
15801629
15811630
15821631 @Callable(i)
15831632 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
15841633
15851634
15861635
15871636 @Callable(i)
15881637 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
15891638
15901639
15911640
15921641 @Callable(i)
15931642 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
15941643 let prices = calcPrices(amAmt, prAmt, lpAmt)
15951644 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
15961645 }
15971646
15981647
15991648
16001649 @Callable(i)
16011650 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
16021651
16031652
16041653
16051654 @Callable(i)
16061655 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
16071656
16081657
16091658
16101659 @Callable(i)
16111660 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
16121661
16131662
16141663
16151664 @Callable(i)
16161665 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
16171666
16181667
16191668
16201669 @Callable(i)
16211670 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
16221671 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
16231672 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
16241673 }
16251674
16261675
16271676
16281677 @Callable(i)
16291678 func statsREADONLY () = {
16301679 let cfg = getPoolConfig()
16311680 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16321681 let amtAssetId = cfg[idxAmtAssetId]
16331682 let priceAssetId = cfg[idxPriceAssetId]
16341683 let iAmtAssetId = cfg[idxIAmtAssetId]
16351684 let iPriceAssetId = cfg[idxIPriceAssetId]
16361685 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16371686 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16381687 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16391688 let accAmtAssetBalance = getAccBalance(amtAssetId)
16401689 let accPriceAssetBalance = getAccBalance(priceAssetId)
16411690 let pricesList = if ((poolLPBalance == 0))
16421691 then [zeroBigInt, zeroBigInt, zeroBigInt]
16431692 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
16441693 let curPrice = 0
16451694 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
16461695 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
16471696 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
16481697 $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))
16491698 }
16501699
16511700
16521701
16531702 @Callable(i)
16541703 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
16551704 let cfg = getPoolConfig()
16561705 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16571706 let amAssetIdStr = cfg[idxAmtAssetId]
16581707 let amAssetId = fromBase58String(amAssetIdStr)
16591708 let prAssetIdStr = cfg[idxPriceAssetId]
16601709 let prAssetId = fromBase58String(prAssetIdStr)
16611710 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16621711 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16631712 let poolStatus = cfg[idxPoolStatus]
16641713 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16651714 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
16661715 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
16671716 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
16681717 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
16691718 let curPriceX18 = if ((poolLPBalance == 0))
16701719 then zeroBigInt
16711720 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
16721721 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
16731722 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
16741723 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
16751724 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
16761725 let calcLpAmt = estPut._1
16771726 let curPriceCalc = estPut._3
16781727 let amBalance = estPut._4
16791728 let prBalance = estPut._5
16801729 let lpEmission = estPut._6
16811730 $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))
16821731 }
16831732
16841733
16851734
16861735 @Callable(i)
16871736 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
16881737 let cfg = getPoolConfig()
16891738 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16901739 let amAssetIdStr = cfg[idxAmtAssetId]
16911740 let amAssetId = fromBase58String(amAssetIdStr)
16921741 let prAssetIdStr = cfg[idxPriceAssetId]
16931742 let prAssetId = fromBase58String(prAssetIdStr)
16941743 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16951744 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16961745 let poolStatus = cfg[idxPoolStatus]
16971746 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16981747 let amBalanceRaw = getAccBalance(amAssetIdStr)
16991748 let prBalanceRaw = getAccBalance(prAssetIdStr)
17001749 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
17011750 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
17021751 let curPriceX18 = if ((poolLPBalance == 0))
17031752 then zeroBigInt
17041753 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
17051754 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
17061755 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
17071756 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
17081757 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17091758 let calcLpAmt = estPut._1
17101759 let curPriceCalc = estPut._3
17111760 let amBalance = estPut._4
17121761 let prBalance = estPut._5
17131762 let lpEmission = estPut._6
17141763 $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))
17151764 }
17161765
17171766
17181767
17191768 @Callable(i)
17201769 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
17211770 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
17221771 let outAmAmt = res._1
17231772 let outPrAmt = res._2
17241773 let amBalance = res._5
17251774 let prBalance = res._6
17261775 let lpEmission = res._7
17271776 let curPrice = res._8
17281777 let poolStatus = parseIntValue(res._9)
17291778 $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))
17301779 }
17311780
17321781
17331782 @Verifier(tx)
17341783 func verify () = {
17351784 let targetPublicKey = match managerPublicKeyOrUnit() {
17361785 case pk: ByteVector =>
17371786 pk
17381787 case _: Unit =>
17391788 tx.senderPublicKey
17401789 case _ =>
17411790 throw("Match error")
17421791 }
17431792 match tx {
17441793 case order: Order =>
17451794 let matcherPub = getMatcherPubOrFail()
1746- let $t06798568102 = if (skipOrderValidation())
1795+ let $t06919969316 = if (skipOrderValidation())
17471796 then $Tuple2(true, "")
17481797 else validateMatcherOrderAllowed(order)
1749- let orderValid = $t06798568102._1
1750- let orderValidInfo = $t06798568102._2
1798+ let orderValid = $t06919969316._1
1799+ let orderValidInfo = $t06919969316._2
17511800 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17521801 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17531802 if (if (if (orderValid)
17541803 then senderValid
17551804 else false)
17561805 then matcherValid
17571806 else false)
17581807 then true
17591808 else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid)
17601809 case s: SetScriptTransaction =>
17611810 if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey))
17621811 then true
17631812 else {
17641813 let newHash = blake2b256(value(s.script))
17651814 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
17661815 let currentHash = scriptHash(this)
17671816 if ((allowedHash == newHash))
17681817 then (currentHash != newHash)
17691818 else false
17701819 }
17711820 case _ =>
17721821 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
17731822 }
17741823 }
17751824

github/deemru/w8io/169f3d6 
258.70 ms