tx · 2QMt1xAUAyfBfP22YPbgVEM35GXqdRGiUurLCggsA2ug

3N9Ei5vn7JJ6dYBCvMt4X9XLZt5Af3vXq42:  -0.04200000 Waves

2023.05.12 10:06 [2574391] smart account 3N9Ei5vn7JJ6dYBCvMt4X9XLZt5Af3vXq42 > SELF 0.00000000 Waves

{ "type": 13, "id": "2QMt1xAUAyfBfP22YPbgVEM35GXqdRGiUurLCggsA2ug", "fee": 4200000, "feeAssetId": null, "timestamp": 1683875231261, "version": 2, "chainId": 84, "sender": "3N9Ei5vn7JJ6dYBCvMt4X9XLZt5Af3vXq42", "senderPublicKey": "4hJgvbkEWy1ERKvsDSKZyh5qWHdhmspD1q4t2r5VuLnZ", "proofs": [ "RvBPSBCoj4WGrLtbornxEqCsGcTwfpbU3iKupfgroPcBRM5krgngurZZ7Z77mSfWVB3kxTrx89Gcyg9Mdmcp47t" ], "script": "base64:BgKSOAgCEgASBQoDAQQBEgcKBQEEAQgBEgQKAgEEEgMKAQESBAoCAQQSBAoCCAESBAoCCAESBAoCCAESBQoDAQgBEgASBAoCAQESAwoBARIFCgMBAQESBAoCCAgSABIAEgMKAQgSBQoDAQEBEgQKAgEBEgQKAggBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgASAwoBARIDCgEBEgQKAggBIgpsUGRlY2ltYWxzIgZzY2FsZTgiDHNjYWxlOEJpZ0ludCIHc2NhbGUxOCIKemVyb0JpZ0ludCIEYmlnMCIEYmlnMSIEYmlnMiILd2F2ZXNTdHJpbmciA1NFUCIKUG9vbEFjdGl2ZSIPUG9vbFB1dERpc2FibGVkIhNQb29sTWF0Y2hlckRpc2FibGVkIgxQb29sU2h1dGRvd24iDmlkeFBvb2xBZGRyZXNzIg1pZHhQb29sU3RhdHVzIhBpZHhQb29sTFBBc3NldElkIg1pZHhBbXRBc3NldElkIg9pZHhQcmljZUFzc2V0SWQiDmlkeEFtdEFzc2V0RGNtIhBpZHhQcmljZUFzc2V0RGNtIg5pZHhJQW10QXNz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QJkTAkAzAgCCQCkAwEFAmRBCQDMCAIJAKQDAQUCZEMJAMwIAgkApAMBBQJkegkAzAgCCQCmAwEFAmRGCQDMCAIJAKQDAQUCZHkFA25pbAUBagECaWkBAmlqAAQCaWsEAmFRCQECZ24AAwkAAQIFAmFRAgpCeXRlVmVjdG9yBAJncQUCYVEFAmdxAwkAAQIFAmFRAgRVbml0CAUCaWkPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IEAmFRBQJpaQMJAAECBQJhUQIFT3JkZXIEAmVRBQJhUQQCaWwJAQJiagAEAmltAwkBAmVNAAkAlAoCBgIACQECZVABBQJlUQQCYUsIBQJpbQJfMQQCYUwIBQJpbQJfMgQCYU0JAPQDAwgFAmVRCWJvZHlCeXRlcwkAkQMCCAUCZVEGcHJvb2ZzAAAIBQJlUQ9zZW5kZXJQdWJsaWNLZXkEAmFOCQD0AwMIBQJlUQlib2R5Qnl0ZXMJAJEDAggFAmVRBnByb29mcwABBQJpbAMDAwUCYUsFAmFNBwUCYU4HBgkBAmFKBAUCYUsFAmFMBQJhTQUCYU4DCQABAgUCYVECFFNldFNjcmlwdFRyYW5zYWN0aW9uBAJhVgUCYVEDCQD0AwMIBQJpaQlib2R5Qnl0ZXMJAJEDAggFAmlpBnByb29mcwAABQJpawYEAmluCQD2AwEJAQV2YWx1ZQEIBQJhVgZzY3JpcHQEAmlvCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYmQJAQJhRgAEAmlwCQDxBwEFBHRoaXMDCQAAAgUCaW8FAmluCQECIT0CBQJpcAUCaW4HCQD0AwMIBQJpaQlib2R5Qnl0ZXMJAJEDAggFAmlpBnByb29mcwAABQJpaybyJ24=", "height": 2574391, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5qMtq9NP1uQhsXRtwZ4Z9wse9S9CAGPg7M2oyhpqwMsx Next: HbDaEQm5qwks4ZmWPeHgbN1TjafDjawMcqBJrDx6E5pL Diff:
OldNewDifferences
9090 func fc () = "%s__factoryContract"
9191
9292
93-func mpk () = "%s__managerPublicKey"
93+func keyManagerPublicKey () = "%s__managerPublicKey"
9494
9595
96-func pmpk () = "%s__pendingManagerPublicKey"
96+func keyManagerVaultAddress () = "%s__managerVaultAddress"
9797
9898
9999 func pl () = "%s%s__price__last"
174174 func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid)))
175175
176176
177+func addressFromStringOrThis (addressString) = match addressFromString(addressString) {
178+ case a: Address =>
179+ a
180+ case _ =>
181+ this
182+}
183+
184+
185+func getManagerVaultAddressOrThis () = {
186+ let factoryAddress = match getString(fc()) {
187+ case fca: String =>
188+ addressFromStringOrThis(fca)
189+ case _ =>
190+ this
191+ }
192+ match getString(factoryAddress, keyManagerVaultAddress()) {
193+ case s: String =>
194+ addressFromStringOrThis(s)
195+ case _ =>
196+ this
197+ }
198+ }
199+
200+
177201 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
178202
179203
234258
235259 let poolConfigParsed = parsePoolConfig(getPoolConfig())
236260
237-let $t090589224 = poolConfigParsed
261+let $t095299695 = poolConfigParsed
238262
239-let cfgPoolAddress = $t090589224._1
263+let cfgPoolAddress = $t095299695._1
240264
241-let cfgPoolStatus = $t090589224._2
265+let cfgPoolStatus = $t095299695._2
242266
243-let cfgLpAssetId = $t090589224._3
267+let cfgLpAssetId = $t095299695._3
244268
245-let cfgAmountAssetId = $t090589224._4
269+let cfgAmountAssetId = $t095299695._4
246270
247-let cfgPriceAssetId = $t090589224._5
271+let cfgPriceAssetId = $t095299695._5
248272
249-let cfgAmountAssetDecimals = $t090589224._6
273+let cfgAmountAssetDecimals = $t095299695._6
250274
251-let cfgPriceAssetDecimals = $t090589224._7
275+let cfgPriceAssetDecimals = $t095299695._7
252276
253277 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
254278
397421
398422
399423 func rebalanceAsset (assetId) = {
400- let $t01546015596 = getLeaseProxyConfig(assetId)
401- let isLeasable = $t01546015596._1
402- let leasedRatio = $t01546015596._2
403- let minBalance = $t01546015596._3
404- let proxyAddress = $t01546015596._4
405- let proxyAssetId = $t01546015596._5
406- let proxyRateMul = $t01546015596._6
407- let stakingProfitAddress = $t01546015596._7
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
408432 if (isLeasable)
409433 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
410434 else nil
412436
413437
414438 func withdrawAndRebalanceAsset (assetId,getAmount) = {
415- let $t01599516131 = getLeaseProxyConfig(assetId)
416- let isLeasable = $t01599516131._1
417- let leasedRatio = $t01599516131._2
418- let minBalance = $t01599516131._3
419- let proxyAddress = $t01599516131._4
420- let proxyAssetId = $t01599516131._5
421- let proxyRateMul = $t01599516131._6
422- let stakingProfitAddress = $t01599516131._7
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
423447 if (isLeasable)
424448 then {
425449 let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
632656 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
633657 let amountAssetAmount = order.amount
634658 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
635- let $t02852028732 = if ((order.orderType == Buy))
659+ let $t02899129203 = if ((order.orderType == Buy))
636660 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
637661 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
638- let amountAssetBalanceDelta = $t02852028732._1
639- let priceAssetBalanceDelta = $t02852028732._2
662+ let amountAssetBalanceDelta = $t02899129203._1
663+ let priceAssetBalanceDelta = $t02899129203._2
640664 if (if (if (isGlobalShutdown())
641665 then true
642666 else (cfgPoolStatus == PoolMatcherDisabled))
649673 then throw("Wrong order assets.")
650674 else {
651675 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
652- let $t02917229272 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
653- let unusedActions = $t02917229272._1
654- let kLpNew = $t02917229272._2
676+ let $t02964329743 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
677+ let unusedActions = $t02964329743._1
678+ let kLpNew = $t02964329743._2
655679 let isOrderValid = (kLpNew >= kLp)
656680 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
657681 $Tuple2(isOrderValid, info)
730754 else if ((paymentAssetId == cfgPriceAssetId))
731755 then false
732756 else throwErr("invalid asset")
733- let $t03238532678 = if (isEval)
757+ let $t03285633149 = if (isEval)
734758 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
735759 else if (paymentInAmountAsset)
736760 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
737761 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
738- let amountBalanceOld = $t03238532678._1
739- let priceBalanceOld = $t03238532678._2
740- let $t03268232831 = if (paymentInAmountAsset)
762+ let amountBalanceOld = $t03285633149._1
763+ let priceBalanceOld = $t03285633149._2
764+ let $t03315333302 = if (paymentInAmountAsset)
741765 then $Tuple2(paymentAmountRaw, 0)
742766 else $Tuple2(0, paymentAmountRaw)
743- let amountAssetAmountRaw = $t03268232831._1
744- let priceAssetAmountRaw = $t03268232831._2
767+ let amountAssetAmountRaw = $t03315333302._1
768+ let priceAssetAmountRaw = $t03315333302._2
745769 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
746770 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
747- let $t03296333027 = takeFee(paymentAmountRaw, inFee)
748- let paymentAmount = $t03296333027._1
749- let feeAmount = $t03296333027._2
771+ let $t03343433498 = takeFee(paymentAmountRaw, inFee)
772+ let paymentAmount = $t03343433498._1
773+ let feeAmount = $t03343433498._2
750774 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
751775 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
752776 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
769793 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
770794 let priceOld = fromX18(priceOldX18, scale8)
771795 let loss = {
772- let $t03470834875 = if (paymentInAmountAsset)
796+ let $t03517935346 = if (paymentInAmountAsset)
773797 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
774798 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
775- let amount = $t03470834875._1
776- let balance = $t03470834875._2
799+ let amount = $t03517935346._1
800+ let balance = $t03517935346._2
777801 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
778802 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
779803 }
813837 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
814838 let redeemedBigInt = toBigInt(paymentAmount)
815839 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
816- let $t03695337009 = takeFee(amountRaw, outFee)
817- let totalAmount = $t03695337009._1
818- let feeAmount = $t03695337009._2
819- let $t03701337239 = if (outInAmountAsset)
840+ let $t03742437480 = takeFee(amountRaw, outFee)
841+ let totalAmount = $t03742437480._1
842+ let feeAmount = $t03742437480._2
843+ let $t03748437710 = if (outInAmountAsset)
820844 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
821845 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
822- let outAmAmount = $t03701337239._1
823- let outPrAmount = $t03701337239._2
824- let amBalanceNew = $t03701337239._3
825- let prBalanceNew = $t03701337239._4
846+ let outAmAmount = $t03748437710._1
847+ let outPrAmount = $t03748437710._2
848+ let amBalanceNew = $t03748437710._3
849+ let prBalanceNew = $t03748437710._4
826850 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
827851 let priceNew = fromX18(priceNewX18, scale8)
828852 let commonState = if (isEval)
840864 }
841865
842866
843-func managerPublicKeyOrUnit () = match getString(mpk()) {
844- case s: String =>
845- fromBase58String(s)
846- case _: Unit =>
847- unit
848- case _ =>
849- throw("Match error")
850-}
851-
852-
853-func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
854- case s: String =>
855- fromBase58String(s)
856- case _: Unit =>
857- unit
858- case _ =>
859- throw("Match error")
860-}
867+func managerPublicKeyOrUnit () = {
868+ let managerVaultAddress = getManagerVaultAddressOrThis()
869+ match getString(managerVaultAddress, keyManagerPublicKey()) {
870+ case s: String =>
871+ fromBase58String(s)
872+ case _: Unit =>
873+ unit
874+ case _ =>
875+ throw("Match error")
876+ }
877+ }
861878
862879
863880 func isManager (i) = match managerPublicKeyOrUnit() {
894911
895912 @Callable(i)
896913 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
897- let $t03912539430 = if ((isReverse == false))
914+ let $t03956939874 = if ((isReverse == false))
898915 then {
899916 let assetOut = getStringOrFail(this, pa())
900917 let assetIn = getStringOrFail(this, aa())
905922 let assetIn = getStringOrFail(this, pa())
906923 $Tuple2(assetOut, assetIn)
907924 }
908- let assetOut = $t03912539430._1
909- let assetIn = $t03912539430._2
925+ let assetOut = $t03956939874._1
926+ let assetIn = $t03956939874._2
910927 let poolAssetInBalance = getAccBalance(assetIn)
911928 let poolAssetOutBalance = getAccBalance(assetOut)
912929 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
977994
978995
979996 @Callable(i)
980-func setManager (pendingManagerPublicKey) = {
981- let checkCaller = mustManager(i)
982- if ((checkCaller == checkCaller))
983- then {
984- let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
985- if ((checkManagerPublicKey == checkManagerPublicKey))
986- then [StringEntry(pmpk(), pendingManagerPublicKey)]
987- else throw("Strict value is not equal to itself.")
988- }
989- else throw("Strict value is not equal to itself.")
990- }
991-
992-
993-
994-@Callable(i)
995-func confirmManager () = {
996- let pm = pendingManagerPublicKeyOrUnit()
997- let hasPM = if (isDefined(pm))
998- then true
999- else throw("No pending manager")
1000- if ((hasPM == hasPM))
1001- then {
1002- let checkPM = if ((i.callerPublicKey == value(pm)))
1003- then true
1004- else throw("You are not pending manager")
1005- if ((checkPM == checkPM))
1006- then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
1007- else throw("Strict value is not equal to itself.")
1008- }
1009- else throw("Strict value is not equal to itself.")
1010- }
1011-
1012-
1013-
1014-@Callable(i)
1015997 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
1016998 then throw("Invalid slippageTolerance passed")
1017999 else {
10571039 else throw("Strict value is not equal to itself.")
10581040 }
10591041 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1060- let $t04447644938 = refreshKLpInternal(0, 0, 0)
1061- if (($t04447644938 == $t04447644938))
1042+ let $t04436144823 = refreshKLpInternal(0, 0, 0)
1043+ if (($t04436144823 == $t04436144823))
10621044 then {
1063- let updatedKLp = $t04447644938._2
1064- let refreshKLpActions = $t04447644938._1
1045+ let updatedKLp = $t04436144823._2
1046+ let refreshKLpActions = $t04436144823._1
10651047 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10661048 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10671049 then {
10981080 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10991081 if ((currentKLp == currentKLp))
11001082 then {
1101- let $t04555045615 = refreshKLpInternal(0, 0, 0)
1102- let refreshKLpActions = $t04555045615._1
1103- let updatedKLp = $t04555045615._2
1083+ let $t04543545500 = refreshKLpInternal(0, 0, 0)
1084+ let refreshKLpActions = $t04543545500._1
1085+ let updatedKLp = $t04543545500._2
11041086 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11051087 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11061088 then (state ++ refreshKLpActions)
11471129 then {
11481130 let userAddress = i.caller
11491131 let txId = i.transactionId
1150- let $t04680346955 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1151- if (($t04680346955 == $t04680346955))
1132+ let $t04668846840 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1133+ if (($t04668846840 == $t04668846840))
11521134 then {
1153- let paymentInAmountAsset = $t04680346955._5
1154- let bonus = $t04680346955._4
1155- let feeAmount = $t04680346955._3
1156- let commonState = $t04680346955._2
1157- let emitAmountEstimated = $t04680346955._1
1135+ let paymentInAmountAsset = $t04668846840._5
1136+ let bonus = $t04668846840._4
1137+ let feeAmount = $t04668846840._3
1138+ let commonState = $t04668846840._2
1139+ let emitAmountEstimated = $t04668846840._1
11581140 let emitAmount = if (if ((minOutAmount > 0))
11591141 then (minOutAmount > emitAmountEstimated)
11601142 else false)
11741156 let sendFee = if ((feeAmount > 0))
11751157 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11761158 else nil
1177- let $t04754147738 = if ((this == feeCollectorAddress))
1159+ let $t04742647623 = if ((this == feeCollectorAddress))
11781160 then $Tuple2(0, 0)
11791161 else if (paymentInAmountAsset)
11801162 then $Tuple2(-(feeAmount), 0)
11811163 else $Tuple2(0, -(feeAmount))
1182- let amountAssetBalanceDelta = $t04754147738._1
1183- let priceAssetBalanceDelta = $t04754147738._2
1184- let $t04774147849 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1185- let refreshKLpActions = $t04774147849._1
1186- let updatedKLp = $t04774147849._2
1164+ let amountAssetBalanceDelta = $t04742647623._1
1165+ let priceAssetBalanceDelta = $t04742647623._2
1166+ let $t04762647734 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1167+ let refreshKLpActions = $t04762647734._1
1168+ let updatedKLp = $t04762647734._2
11871169 let kLp = value(getString(keyKLp))
11881170 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11891171 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12081190
12091191 @Callable(i)
12101192 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1211- let $t04820448361 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1212- let emitAmountEstimated = $t04820448361._1
1213- let commonState = $t04820448361._2
1214- let feeAmount = $t04820448361._3
1215- let bonus = $t04820448361._4
1216- let paymentInAmountAsset = $t04820448361._5
1193+ let $t04808948246 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1194+ let emitAmountEstimated = $t04808948246._1
1195+ let commonState = $t04808948246._2
1196+ let feeAmount = $t04808948246._3
1197+ let bonus = $t04808948246._4
1198+ let paymentInAmountAsset = $t04808948246._5
12171199 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12181200 }
12191201
12501232 then {
12511233 let userAddress = i.caller
12521234 let txId = i.transactionId
1253- let $t04924649399 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1254- if (($t04924649399 == $t04924649399))
1235+ let $t04913149284 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1236+ if (($t04913149284 == $t04913149284))
12551237 then {
1256- let outInAmountAsset = $t04924649399._5
1257- let bonus = $t04924649399._4
1258- let feeAmount = $t04924649399._3
1259- let commonState = $t04924649399._2
1260- let amountEstimated = $t04924649399._1
1238+ let outInAmountAsset = $t04913149284._5
1239+ let bonus = $t04913149284._4
1240+ let feeAmount = $t04913149284._3
1241+ let commonState = $t04913149284._2
1242+ let amountEstimated = $t04913149284._1
12611243 let amount = if (if ((minOutAmount > 0))
12621244 then (minOutAmount > amountEstimated)
12631245 else false)
12711253 let sendFee = if ((feeAmount > 0))
12721254 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12731255 else nil
1274- let $t05006350310 = {
1256+ let $t04994850195 = {
12751257 let feeAmountForCalc = if ((this == feeCollectorAddress))
12761258 then 0
12771259 else feeAmount
12791261 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12801262 else $Tuple2(0, -((amount + feeAmountForCalc)))
12811263 }
1282- let amountAssetBalanceDelta = $t05006350310._1
1283- let priceAssetBalanceDelta = $t05006350310._2
1284- let $t05031350421 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1285- let refreshKLpActions = $t05031350421._1
1286- let updatedKLp = $t05031350421._2
1264+ let amountAssetBalanceDelta = $t04994850195._1
1265+ let priceAssetBalanceDelta = $t04994850195._2
1266+ let $t05019850306 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1267+ let refreshKLpActions = $t05019850306._1
1268+ let updatedKLp = $t05019850306._2
12871269 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12881270 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12891271 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13021284
13031285 @Callable(i)
13041286 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1305- let $t05069950855 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1306- let amountEstimated = $t05069950855._1
1307- let commonState = $t05069950855._2
1308- let feeAmount = $t05069950855._3
1309- let bonus = $t05069950855._4
1310- let outInAmountAsset = $t05069950855._5
1287+ let $t05058450740 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1288+ let amountEstimated = $t05058450740._1
1289+ let commonState = $t05058450740._2
1290+ let feeAmount = $t05058450740._3
1291+ let bonus = $t05058450740._4
1292+ let outInAmountAsset = $t05058450740._5
13111293 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13121294 }
13131295
13441326 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13451327 if ((unstakeInv == unstakeInv))
13461328 then {
1347- let $t05176051911 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1348- if (($t05176051911 == $t05176051911))
1329+ let $t05164551796 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1330+ if (($t05164551796 == $t05164551796))
13491331 then {
1350- let outInAmountAsset = $t05176051911._5
1351- let bonus = $t05176051911._4
1352- let feeAmount = $t05176051911._3
1353- let commonState = $t05176051911._2
1354- let amountEstimated = $t05176051911._1
1332+ let outInAmountAsset = $t05164551796._5
1333+ let bonus = $t05164551796._4
1334+ let feeAmount = $t05164551796._3
1335+ let commonState = $t05164551796._2
1336+ let amountEstimated = $t05164551796._1
13551337 let amount = if (if ((minOutAmount > 0))
13561338 then (minOutAmount > amountEstimated)
13571339 else false)
13651347 let sendFee = if ((feeAmount > 0))
13661348 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13671349 else nil
1368- let $t05257052817 = {
1350+ let $t05245552702 = {
13691351 let feeAmountForCalc = if ((this == feeCollectorAddress))
13701352 then 0
13711353 else feeAmount
13731355 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13741356 else $Tuple2(0, -((amount + feeAmountForCalc)))
13751357 }
1376- let amountAssetBalanceDelta = $t05257052817._1
1377- let priceAssetBalanceDelta = $t05257052817._2
1378- let $t05282052928 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1379- let refreshKLpActions = $t05282052928._1
1380- let updatedKLp = $t05282052928._2
1358+ let amountAssetBalanceDelta = $t05245552702._1
1359+ let priceAssetBalanceDelta = $t05245552702._2
1360+ let $t05270552813 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1361+ let refreshKLpActions = $t05270552813._1
1362+ let updatedKLp = $t05270552813._2
13811363 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13821364 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13831365 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
14111393 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14121394 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14131395 then {
1414- let $t05402354104 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1415- let refreshKLpActions = $t05402354104._1
1416- let updatedKLp = $t05402354104._2
1396+ let $t05390853989 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1397+ let refreshKLpActions = $t05390853989._1
1398+ let updatedKLp = $t05390853989._2
14171399 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14181400 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14191401 then ((withdrawState ++ state) ++ refreshKLpActions)
14461428 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14471429 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14481430 then {
1449- let $t05519955280 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1450- let refreshKLpActions = $t05519955280._1
1451- let updatedKLp = $t05519955280._2
1431+ let $t05508455165 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1432+ let refreshKLpActions = $t05508455165._1
1433+ let updatedKLp = $t05508455165._2
14521434 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14531435 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14541436 then ((withdrawState ++ state) ++ refreshKLpActions)
14931475 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14941476 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14951477 then {
1496- let $t05655256633 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1497- let refreshKLpActions = $t05655256633._1
1498- let updatedKLp = $t05655256633._2
1478+ let $t05643756518 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1479+ let refreshKLpActions = $t05643756518._1
1480+ let updatedKLp = $t05643756518._2
14991481 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15001482 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15011483 then ((withdrawState ++ state) ++ refreshKLpActions)
15471529 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15481530 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15491531 then {
1550- let $t05807458155 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1551- let refreshKLpActions = $t05807458155._1
1552- let updatedKLp = $t05807458155._2
1532+ let $t05795958040 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1533+ let refreshKLpActions = $t05795958040._1
1534+ let updatedKLp = $t05795958040._2
15531535 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15541536 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15551537 then ((withdrawState ++ state) ++ refreshKLpActions)
15841566 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15851567 then {
15861568 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1587- let $t05935959423 = refreshKLpInternal(0, 0, 0)
1588- let kLpUpdateActions = $t05935959423._1
1589- let updatedKLp = $t05935959423._2
1569+ let $t05924459308 = refreshKLpInternal(0, 0, 0)
1570+ let kLpUpdateActions = $t05924459308._1
1571+ let updatedKLp = $t05924459308._2
15901572 let actions = if ((kLp != updatedKLp))
15911573 then kLpUpdateActions
15921574 else throwErr("nothing to refresh")
17611743 match tx {
17621744 case order: Order =>
17631745 let matcherPub = getMatcherPubOrFail()
1764- let $t06808568202 = if (skipOrderValidation())
1746+ let $t06797068087 = if (skipOrderValidation())
17651747 then $Tuple2(true, "")
17661748 else validateMatcherOrderAllowed(order)
1767- let orderValid = $t06808568202._1
1768- let orderValidInfo = $t06808568202._2
1749+ let orderValid = $t06797068087._1
1750+ let orderValidInfo = $t06797068087._2
17691751 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17701752 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17711753 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
93-func mpk () = "%s__managerPublicKey"
93+func keyManagerPublicKey () = "%s__managerPublicKey"
9494
9595
96-func pmpk () = "%s__pendingManagerPublicKey"
96+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
177+func addressFromStringOrThis (addressString) = match addressFromString(addressString) {
178+ case a: Address =>
179+ a
180+ case _ =>
181+ this
182+}
183+
184+
185+func getManagerVaultAddressOrThis () = {
186+ let factoryAddress = match getString(fc()) {
187+ case fca: String =>
188+ addressFromStringOrThis(fca)
189+ case _ =>
190+ this
191+ }
192+ match getString(factoryAddress, keyManagerVaultAddress()) {
193+ case s: String =>
194+ addressFromStringOrThis(s)
195+ case _ =>
196+ this
197+ }
198+ }
199+
200+
177201 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
178202
179203
180204 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
181205
182206
183207 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
184208
185209
186210 func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
187211
188212
189213 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
190214
191215 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
192216
193217 let inFee = {
194218 let @ = invoke(factoryContract, "getInFeeREADONLY", [toString(this)], nil)
195219 if ($isInstanceOf(@, "Int"))
196220 then @
197221 else throw(($getType(@) + " couldn't be cast to Int"))
198222 }
199223
200224 let outFee = {
201225 let @ = invoke(factoryContract, "getOutFeeREADONLY", [toString(this)], nil)
202226 if ($isInstanceOf(@, "Int"))
203227 then @
204228 else throw(($getType(@) + " couldn't be cast to Int"))
205229 }
206230
207231 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
208232
209233
210234 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
211235
212236
213237 func getPoolConfig () = {
214238 let amtAsset = getStringOrFail(this, aa())
215239 let priceAsset = getStringOrFail(this, pa())
216240 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
217241 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
218242 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
219243 }
220244
221245
222246 func parseAssetId (input) = if ((input == wavesString))
223247 then unit
224248 else fromBase58String(input)
225249
226250
227251 func assetIdToString (input) = if ((input == unit))
228252 then wavesString
229253 else toBase58String(value(input))
230254
231255
232256 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]))
233257
234258
235259 let poolConfigParsed = parsePoolConfig(getPoolConfig())
236260
237-let $t090589224 = poolConfigParsed
261+let $t095299695 = poolConfigParsed
238262
239-let cfgPoolAddress = $t090589224._1
263+let cfgPoolAddress = $t095299695._1
240264
241-let cfgPoolStatus = $t090589224._2
265+let cfgPoolStatus = $t095299695._2
242266
243-let cfgLpAssetId = $t090589224._3
267+let cfgLpAssetId = $t095299695._3
244268
245-let cfgAmountAssetId = $t090589224._4
269+let cfgAmountAssetId = $t095299695._4
246270
247-let cfgPriceAssetId = $t090589224._5
271+let cfgPriceAssetId = $t095299695._5
248272
249-let cfgAmountAssetDecimals = $t090589224._6
273+let cfgAmountAssetDecimals = $t095299695._6
250274
251-let cfgPriceAssetDecimals = $t090589224._7
275+let cfgPriceAssetDecimals = $t095299695._7
252276
253277 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
254278
255279
256280 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
257281
258282 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
259283
260284 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)
261285
262286
263287 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)
264288
265289
266290 func getAccBalance (assetId) = {
267291 let balanceOnPool = if ((assetId == "WAVES"))
268292 then wavesBalance(this).available
269293 else assetBalance(this, fromBase58String(assetId))
270294 let totalBalance = ((balanceOnPool + getAdditionalBalanceOrZero(assetId)) - getStakingAssetBalanceOrZero(assetId))
271295 max([0, totalBalance])
272296 }
273297
274298
275299 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
276300
277301
278302 func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
279303
280304
281305 func getRate (proxy) = {
282306 let inv = invoke(proxy, "getRate", nil, nil)
283307 if ((inv == inv))
284308 then match inv {
285309 case r: Int =>
286310 r
287311 case _ =>
288312 throwErr("proxy.getRate() unexpected value")
289313 }
290314 else throw("Strict value is not equal to itself.")
291315 }
292316
293317
294318 func deposit (assetId,amount,stakingAssetId,proxy) = {
295319 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
296320 if ((currentAdditionalBalance == currentAdditionalBalance))
297321 then {
298322 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
299323 if ((currentStakingAssetBalance == currentStakingAssetBalance))
300324 then {
301325 let asset = parseAssetId(assetId)
302326 if ((amount > 0))
303327 then {
304328 let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)])
305329 if ((depositInvoke == depositInvoke))
306330 then match depositInvoke {
307331 case receivedStakingAsset: Int =>
308332 let newAdditionalBalance = (currentAdditionalBalance + amount)
309333 let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
310334 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
311335 case _ =>
312336 nil
313337 }
314338 else throw("Strict value is not equal to itself.")
315339 }
316340 else nil
317341 }
318342 else throw("Strict value is not equal to itself.")
319343 }
320344 else throw("Strict value is not equal to itself.")
321345 }
322346
323347
324348 func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul,profitAddress) = {
325349 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
326350 if ((currentAdditionalBalance == currentAdditionalBalance))
327351 then {
328352 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
329353 if ((currentStakingAssetBalance == currentStakingAssetBalance))
330354 then {
331355 let currentProxyRate = getRate(proxy)
332356 if ((currentProxyRate == currentProxyRate))
333357 then {
334358 let oldRate = fraction(proxyRateMul, currentAdditionalBalance, currentStakingAssetBalance)
335359 let stakingAsset = parseAssetId(stakingAssetId)
336360 let oldSendStakingAmount = fraction(proxyRateMul, amount, oldRate)
337361 let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
338362 let profitAmount = max([0, (oldSendStakingAmount - sendStakingAssetAmount)])
339363 if ((sendStakingAssetAmount > 0))
340364 then {
341365 let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
342366 if ((withdrawInvoke == withdrawInvoke))
343367 then match withdrawInvoke {
344368 case receivedAssets: Int =>
345369 let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
346370 let newStakingAssetBalance = ((currentStakingAssetBalance - sendStakingAssetAmount) - profitAmount)
347371 [IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance), ScriptTransfer(profitAddress, profitAmount, parseAssetId(stakingAssetId))]
348372 case _ =>
349373 nil
350374 }
351375 else throw("Strict value is not equal to itself.")
352376 }
353377 else nil
354378 }
355379 else throw("Strict value is not equal to itself.")
356380 }
357381 else throw("Strict value is not equal to itself.")
358382 }
359383 else throw("Strict value is not equal to itself.")
360384 }
361385
362386
363387 func getLeaseProxyConfig (assetId) = match invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil) {
364388 case a: (Boolean, Int, Int, String, String, Int, String) =>
365389 a
366390 case _ =>
367391 throwErr((("[" + assetId) + "] getLeaseProxyConfig() error"))
368392 }
369393
370394
371395 func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul,profitAddress) = {
372396 let currentAdditionalBalance = getAdditionalBalanceOrZero(assetId)
373397 if ((currentAdditionalBalance == currentAdditionalBalance))
374398 then {
375399 let currentStakingAssetBalance = getStakingAssetBalanceOrZero(stakingAssetId)
376400 if ((currentStakingAssetBalance == currentStakingAssetBalance))
377401 then {
378402 let leasableTotalBalance = max([0, (getAccBalance(assetId) - minBalance)])
379403 let targetAdditionalBalance = fraction(targetRatio, leasableTotalBalance, 100)
380404 let diff = (currentAdditionalBalance - targetAdditionalBalance)
381405 if ((diff == 0))
382406 then nil
383407 else if ((0 > diff))
384408 then {
385409 let sendAssetAmount = -(diff)
386410 deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
387411 }
388412 else {
389413 let getAssetAmount = diff
390414 withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul, profitAddress)
391415 }
392416 }
393417 else throw("Strict value is not equal to itself.")
394418 }
395419 else throw("Strict value is not equal to itself.")
396420 }
397421
398422
399423 func rebalanceAsset (assetId) = {
400- let $t01546015596 = getLeaseProxyConfig(assetId)
401- let isLeasable = $t01546015596._1
402- let leasedRatio = $t01546015596._2
403- let minBalance = $t01546015596._3
404- let proxyAddress = $t01546015596._4
405- let proxyAssetId = $t01546015596._5
406- let proxyRateMul = $t01546015596._6
407- let stakingProfitAddress = $t01546015596._7
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
408432 if (isLeasable)
409433 then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
410434 else nil
411435 }
412436
413437
414438 func withdrawAndRebalanceAsset (assetId,getAmount) = {
415- let $t01599516131 = getLeaseProxyConfig(assetId)
416- let isLeasable = $t01599516131._1
417- let leasedRatio = $t01599516131._2
418- let minBalance = $t01599516131._3
419- let proxyAddress = $t01599516131._4
420- let proxyAssetId = $t01599516131._5
421- let proxyRateMul = $t01599516131._6
422- let stakingProfitAddress = $t01599516131._7
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
423447 if (isLeasable)
424448 then {
425449 let newTotalLeasableBalance = max([0, ((getAccBalance(assetId) - getAmount) - minBalance)])
426450 if ((newTotalLeasableBalance == newTotalLeasableBalance))
427451 then {
428452 let newAdditionalBalance = fraction(leasedRatio, newTotalLeasableBalance, 100)
429453 if ((newAdditionalBalance == newAdditionalBalance))
430454 then {
431455 let withdrawAmount = (getAdditionalBalanceOrZero(assetId) - newAdditionalBalance)
432456 if ((withdrawAmount == withdrawAmount))
433457 then if ((0 > withdrawAmount))
434458 then deposit(assetId, -(withdrawAmount), proxyAssetId, addressFromStringValue(proxyAddress))
435459 else withdraw(assetId, withdrawAmount, proxyAssetId, addressFromStringValue(proxyAddress), proxyRateMul, addressFromStringValue(stakingProfitAddress))
436460 else throw("Strict value is not equal to itself.")
437461 }
438462 else throw("Strict value is not equal to itself.")
439463 }
440464 else throw("Strict value is not equal to itself.")
441465 }
442466 else nil
443467 }
444468
445469
446470 func withdrawAndRebalanceAll (amountAssetOutAmount,priceAssetOutAmount) = {
447471 let AmAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, aa()), amountAssetOutAmount)
448472 let PrAmtWithdrawState = withdrawAndRebalanceAsset(getStringOrFail(this, pa()), priceAssetOutAmount)
449473 (AmAmtWithdrawState ++ PrAmtWithdrawState)
450474 }
451475
452476
453477 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
454478 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
455479 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
456480 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
457481 }
458482
459483
460484 func calcPrices (amAmt,prAmt,lpAmt) = {
461485 let cfg = getPoolConfig()
462486 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
463487 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
464488 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
465489 let amAmtX18 = toX18(amAmt, amtAssetDcm)
466490 let prAmtX18 = toX18(prAmt, priceAssetDcm)
467491 let lpAmtX18 = toX18(lpAmt, scale8)
468492 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
469493 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
470494 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
471495 }
472496
473497
474498 func calculatePrices (amAmt,prAmt,lpAmt) = {
475499 let prices = calcPrices(amAmt, prAmt, lpAmt)
476500 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
477501 }
478502
479503
480504 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
481505 let cfg = getPoolConfig()
482506 let lpAssetId = cfg[idxPoolLPAssetId]
483507 let amAssetId = cfg[idxAmtAssetId]
484508 let prAssetId = cfg[idxPriceAssetId]
485509 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
486510 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
487511 let poolStatus = cfg[idxPoolStatus]
488512 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
489513 if ((lpAssetId != pmtAssetId))
490514 then throw("Invalid asset passed.")
491515 else {
492516 let amBalance = getAccBalance(amAssetId)
493517 let amBalanceX18 = toX18(amBalance, amAssetDcm)
494518 let prBalance = getAccBalance(prAssetId)
495519 let prBalanceX18 = toX18(prBalance, prAssetDcm)
496520 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
497521 let curPrice = fromX18(curPriceX18, scale8)
498522 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
499523 let lpEmissionX18 = toX18(lpEmission, scale8)
500524 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
501525 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
502526 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
503527 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
504528 let state = if ((txId58 == ""))
505529 then nil
506530 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
507531 then unit
508532 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
509533 then unit
510534 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)]
511535 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
512536 }
513537 }
514538
515539
516540 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
517541 let cfg = getPoolConfig()
518542 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
519543 let amAssetIdStr = cfg[idxAmtAssetId]
520544 let prAssetIdStr = cfg[idxPriceAssetId]
521545 let iAmtAssetId = cfg[idxIAmtAssetId]
522546 let iPriceAssetId = cfg[idxIPriceAssetId]
523547 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
524548 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
525549 let poolStatus = cfg[idxPoolStatus]
526550 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
527551 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
528552 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
529553 if (if ((amAssetIdStr != inAmAssetIdStr))
530554 then true
531555 else (prAssetIdStr != inPrAssetIdStr))
532556 then throw("Invalid amt or price asset passed.")
533557 else {
534558 let amBalance = if (isEvaluate)
535559 then getAccBalance(amAssetIdStr)
536560 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
537561 let prBalance = if (isEvaluate)
538562 then getAccBalance(prAssetIdStr)
539563 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
540564 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
541565 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
542566 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
543567 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
544568 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
545569 let res = if ((lpEmission == 0))
546570 then {
547571 let curPriceX18 = zeroBigInt
548572 let slippageX18 = zeroBigInt
549573 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
550574 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
551575 }
552576 else {
553577 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
554578 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
555579 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
556580 if (if ((curPriceX18 != zeroBigInt))
557581 then (slippageX18 > slippageToleranceX18)
558582 else false)
559583 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
560584 else {
561585 let lpEmissionX18 = toX18(lpEmission, scale8)
562586 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
563587 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
564588 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
565589 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
566590 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
567591 let expAmtAssetAmtX18 = expectedAmts._1
568592 let expPriceAssetAmtX18 = expectedAmts._2
569593 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
570594 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
571595 }
572596 }
573597 let calcLpAmt = res._1
574598 let calcAmAssetPmt = res._2
575599 let calcPrAssetPmt = res._3
576600 let curPrice = fromX18(res._4, scale8)
577601 let slippageCalc = fromX18(res._5, scale8)
578602 if ((0 >= calcLpAmt))
579603 then throw("Invalid calculations. LP calculated is less than zero.")
580604 else {
581605 let emitLpAmt = if (!(emitLp))
582606 then 0
583607 else calcLpAmt
584608 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
585609 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
586610 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))]
587611 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
588612 }
589613 }
590614 }
591615
592616
593617 func calcKLp (amountBalance,priceBalance,lpEmission) = {
594618 let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals))
595619 let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))
596620 let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
597621 if ((lpEmission == big0))
598622 then big0
599623 else updatedKLp
600624 }
601625
602626
603627 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
604628 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
605629 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
606630 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
607631 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
608632 currentKLp
609633 }
610634
611635
612636 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
613637 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
614638 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
615639 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
616640 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
617641 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
618642 $Tuple2(actions, updatedKLp)
619643 }
620644
621645
622646 func skipOrderValidation () = valueOrElse(getBoolean(factoryContract, keySkipOrderValidation(toString(this))), false)
623647
624648
625649 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
626650 then true
627651 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
628652
629653
630654 func validateMatcherOrderAllowed (order) = {
631655 let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
632656 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
633657 let amountAssetAmount = order.amount
634658 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
635- let $t02852028732 = if ((order.orderType == Buy))
659+ let $t02899129203 = if ((order.orderType == Buy))
636660 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
637661 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
638- let amountAssetBalanceDelta = $t02852028732._1
639- let priceAssetBalanceDelta = $t02852028732._2
662+ let amountAssetBalanceDelta = $t02899129203._1
663+ let priceAssetBalanceDelta = $t02899129203._2
640664 if (if (if (isGlobalShutdown())
641665 then true
642666 else (cfgPoolStatus == PoolMatcherDisabled))
643667 then true
644668 else (cfgPoolStatus == PoolShutdown))
645669 then throw("Exchange operations disabled")
646670 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
647671 then true
648672 else (order.assetPair.priceAsset != cfgPriceAssetId))
649673 then throw("Wrong order assets.")
650674 else {
651675 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
652- let $t02917229272 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
653- let unusedActions = $t02917229272._1
654- let kLpNew = $t02917229272._2
676+ let $t02964329743 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
677+ let unusedActions = $t02964329743._1
678+ let kLpNew = $t02964329743._2
655679 let isOrderValid = (kLpNew >= kLp)
656680 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
657681 $Tuple2(isOrderValid, info)
658682 }
659683 }
660684
661685
662686 func commonGet (i) = if ((size(i.payments) != 1))
663687 then throw("exactly 1 payment is expected")
664688 else {
665689 let pmt = value(i.payments[0])
666690 let pmtAssetId = value(pmt.assetId)
667691 let pmtAmt = pmt.amount
668692 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
669693 let outAmAmt = res._1
670694 let outPrAmt = res._2
671695 let poolStatus = parseIntValue(res._9)
672696 let state = res._10
673697 if (if (isGlobalShutdown())
674698 then true
675699 else (poolStatus == PoolShutdown))
676700 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
677701 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
678702 }
679703
680704
681705 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
682706 then throw("exactly 2 payments are expected")
683707 else {
684708 let amAssetPmt = value(i.payments[0])
685709 let prAssetPmt = value(i.payments[1])
686710 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
687711 let poolStatus = parseIntValue(estPut._8)
688712 if (if (if (isGlobalShutdown())
689713 then true
690714 else (poolStatus == PoolPutDisabled))
691715 then true
692716 else (poolStatus == PoolShutdown))
693717 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
694718 else estPut
695719 }
696720
697721
698722 func emit (amount) = {
699723 let emitInv = invoke(factoryContract, "emit", [amount], nil)
700724 if ((emitInv == emitInv))
701725 then {
702726 let emitInvLegacy = match emitInv {
703727 case legacyFactoryContract: Address =>
704728 invoke(legacyFactoryContract, "emit", [amount], nil)
705729 case _ =>
706730 unit
707731 }
708732 if ((emitInvLegacy == emitInvLegacy))
709733 then amount
710734 else throw("Strict value is not equal to itself.")
711735 }
712736 else throw("Strict value is not equal to itself.")
713737 }
714738
715739
716740 func takeFee (amount,fee) = {
717741 let feeAmount = if ((fee == 0))
718742 then 0
719743 else fraction(amount, fee, scale8)
720744 $Tuple2((amount - feeAmount), feeAmount)
721745 }
722746
723747
724748 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
725749 let isEval = (txId == unit)
726750 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
727751 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
728752 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
729753 then true
730754 else if ((paymentAssetId == cfgPriceAssetId))
731755 then false
732756 else throwErr("invalid asset")
733- let $t03238532678 = if (isEval)
757+ let $t03285633149 = if (isEval)
734758 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
735759 else if (paymentInAmountAsset)
736760 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
737761 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
738- let amountBalanceOld = $t03238532678._1
739- let priceBalanceOld = $t03238532678._2
740- let $t03268232831 = if (paymentInAmountAsset)
762+ let amountBalanceOld = $t03285633149._1
763+ let priceBalanceOld = $t03285633149._2
764+ let $t03315333302 = if (paymentInAmountAsset)
741765 then $Tuple2(paymentAmountRaw, 0)
742766 else $Tuple2(0, paymentAmountRaw)
743- let amountAssetAmountRaw = $t03268232831._1
744- let priceAssetAmountRaw = $t03268232831._2
767+ let amountAssetAmountRaw = $t03315333302._1
768+ let priceAssetAmountRaw = $t03315333302._2
745769 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
746770 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
747- let $t03296333027 = takeFee(paymentAmountRaw, inFee)
748- let paymentAmount = $t03296333027._1
749- let feeAmount = $t03296333027._2
771+ let $t03343433498 = takeFee(paymentAmountRaw, inFee)
772+ let paymentAmount = $t03343433498._1
773+ let feeAmount = $t03343433498._2
750774 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
751775 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
752776 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
753777 let priceNew = fromX18(priceNewX18, scale8)
754778 let paymentBalance = if (paymentInAmountAsset)
755779 then amountBalanceOld
756780 else priceBalanceOld
757781 let paymentBalanceBigInt = toBigInt(paymentBalance)
758782 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
759783 let chechSupply = if ((supplyBigInt > big0))
760784 then true
761785 else throwErr("initial deposit requires all coins")
762786 if ((chechSupply == chechSupply))
763787 then {
764788 let depositBigInt = toBigInt(paymentAmount)
765789 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
766790 let commonState = if (isEval)
767791 then nil
768792 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))]
769793 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
770794 let priceOld = fromX18(priceOldX18, scale8)
771795 let loss = {
772- let $t03470834875 = if (paymentInAmountAsset)
796+ let $t03517935346 = if (paymentInAmountAsset)
773797 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
774798 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
775- let amount = $t03470834875._1
776- let balance = $t03470834875._2
799+ let amount = $t03517935346._1
800+ let balance = $t03517935346._2
777801 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
778802 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
779803 }
780804 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
781805 }
782806 else throw("Strict value is not equal to itself.")
783807 }
784808
785809
786810 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
787811 let isEval = (txId == unit)
788812 let cfg = getPoolConfig()
789813 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
790814 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
791815 let checks = [if ((paymentAssetId == cfgLpAssetId))
792816 then true
793817 else throwErr("invalid lp asset")]
794818 if ((checks == checks))
795819 then {
796820 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
797821 then true
798822 else if ((outAssetId == cfgPriceAssetId))
799823 then false
800824 else throwErr("invalid asset")
801825 let balanceBigInt = if (outInAmountAsset)
802826 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
803827 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
804828 let outInAmountAssetDecimals = if (outInAmountAsset)
805829 then amtAssetDcm
806830 else priceAssetDcm
807831 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
808832 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
809833 let outBalance = if (outInAmountAsset)
810834 then amBalanceOld
811835 else prBalanceOld
812836 let outBalanceBigInt = toBigInt(outBalance)
813837 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
814838 let redeemedBigInt = toBigInt(paymentAmount)
815839 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
816- let $t03695337009 = takeFee(amountRaw, outFee)
817- let totalAmount = $t03695337009._1
818- let feeAmount = $t03695337009._2
819- let $t03701337239 = if (outInAmountAsset)
840+ let $t03742437480 = takeFee(amountRaw, outFee)
841+ let totalAmount = $t03742437480._1
842+ let feeAmount = $t03742437480._2
843+ let $t03748437710 = if (outInAmountAsset)
820844 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
821845 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
822- let outAmAmount = $t03701337239._1
823- let outPrAmount = $t03701337239._2
824- let amBalanceNew = $t03701337239._3
825- let prBalanceNew = $t03701337239._4
846+ let outAmAmount = $t03748437710._1
847+ let outPrAmount = $t03748437710._2
848+ let amBalanceNew = $t03748437710._3
849+ let prBalanceNew = $t03748437710._4
826850 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
827851 let priceNew = fromX18(priceNewX18, scale8)
828852 let commonState = if (isEval)
829853 then nil
830854 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)]
831855 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
832856 let priceOld = fromX18(priceOldX18, scale8)
833857 let loss = {
834858 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
835859 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
836860 }
837861 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
838862 }
839863 else throw("Strict value is not equal to itself.")
840864 }
841865
842866
843-func managerPublicKeyOrUnit () = match getString(mpk()) {
844- case s: String =>
845- fromBase58String(s)
846- case _: Unit =>
847- unit
848- case _ =>
849- throw("Match error")
850-}
851-
852-
853-func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
854- case s: String =>
855- fromBase58String(s)
856- case _: Unit =>
857- unit
858- case _ =>
859- throw("Match error")
860-}
867+func managerPublicKeyOrUnit () = {
868+ let managerVaultAddress = getManagerVaultAddressOrThis()
869+ match getString(managerVaultAddress, keyManagerPublicKey()) {
870+ case s: String =>
871+ fromBase58String(s)
872+ case _: Unit =>
873+ unit
874+ case _ =>
875+ throw("Match error")
876+ }
877+ }
861878
862879
863880 func isManager (i) = match managerPublicKeyOrUnit() {
864881 case pk: ByteVector =>
865882 (i.callerPublicKey == pk)
866883 case _: Unit =>
867884 (i.caller == this)
868885 case _ =>
869886 throw("Match error")
870887 }
871888
872889
873890 func mustManager (i) = {
874891 let pd = throw("Permission denied")
875892 match managerPublicKeyOrUnit() {
876893 case pk: ByteVector =>
877894 if ((i.callerPublicKey == pk))
878895 then true
879896 else pd
880897 case _: Unit =>
881898 if ((i.caller == this))
882899 then true
883900 else pd
884901 case _ =>
885902 throw("Match error")
886903 }
887904 }
888905
889906
890907 @Callable(i)
891908 func rebalance () = (rebalanceAsset(getStringOrFail(this, aa())) ++ rebalanceAsset(getStringOrFail(this, pa())))
892909
893910
894911
895912 @Callable(i)
896913 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
897- let $t03912539430 = if ((isReverse == false))
914+ let $t03956939874 = if ((isReverse == false))
898915 then {
899916 let assetOut = getStringOrFail(this, pa())
900917 let assetIn = getStringOrFail(this, aa())
901918 $Tuple2(assetOut, assetIn)
902919 }
903920 else {
904921 let assetOut = getStringOrFail(this, aa())
905922 let assetIn = getStringOrFail(this, pa())
906923 $Tuple2(assetOut, assetIn)
907924 }
908- let assetOut = $t03912539430._1
909- let assetIn = $t03912539430._2
925+ let assetOut = $t03956939874._1
926+ let assetIn = $t03956939874._2
910927 let poolAssetInBalance = getAccBalance(assetIn)
911928 let poolAssetOutBalance = getAccBalance(assetOut)
912929 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
913930 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
914931 let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
915932 let checkK = if ((newK >= oldK))
916933 then true
917934 else throw("new K is fewer error")
918935 if ((checkK == checkK))
919936 then $Tuple2(nil, amountOut)
920937 else throw("Strict value is not equal to itself.")
921938 }
922939
923940
924941
925942 @Callable(i)
926943 func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = {
927944 let swapContact = {
928945 let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil)
929946 if ($isInstanceOf(@, "String"))
930947 then @
931948 else throw(($getType(@) + " couldn't be cast to String"))
932949 }
933950 let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
934951 then true
935952 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
936953 then true
937954 else throwErr("Permission denied")]
938955 if ((checks == checks))
939956 then {
940957 let pmt = value(i.payments[0])
941958 let assetIn = assetIdToString(pmt.assetId)
942959 let assetOut = if ((isReverse == false))
943960 then getStringOrFail(this, pa())
944961 else getStringOrFail(this, aa())
945962 let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount)
946963 let poolAssetOutBalance = getAccBalance(assetOut)
947964 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
948965 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
949966 let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
950967 let checkK = if ((newK >= oldK))
951968 then true
952969 else throw("new K is fewer error")
953970 if ((checkK == checkK))
954971 then {
955972 let checkMin = if ((amountOut >= amountOutMin))
956973 then true
957974 else throw("Exchange result is fewer coins than expected")
958975 if ((checkMin == checkMin))
959976 then {
960977 let rebalanceState = rebalanceAsset(assetIn)
961978 if ((rebalanceState == rebalanceState))
962979 then {
963980 let withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
964981 if ((withdrawState == withdrawState))
965982 then $Tuple2(((withdrawState ++ rebalanceState) ++ [ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))]), amountOut)
966983 else throw("Strict value is not equal to itself.")
967984 }
968985 else throw("Strict value is not equal to itself.")
969986 }
970987 else throw("Strict value is not equal to itself.")
971988 }
972989 else throw("Strict value is not equal to itself.")
973990 }
974991 else throw("Strict value is not equal to itself.")
975992 }
976993
977994
978995
979996 @Callable(i)
980-func setManager (pendingManagerPublicKey) = {
981- let checkCaller = mustManager(i)
982- if ((checkCaller == checkCaller))
983- then {
984- let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
985- if ((checkManagerPublicKey == checkManagerPublicKey))
986- then [StringEntry(pmpk(), pendingManagerPublicKey)]
987- else throw("Strict value is not equal to itself.")
988- }
989- else throw("Strict value is not equal to itself.")
990- }
991-
992-
993-
994-@Callable(i)
995-func confirmManager () = {
996- let pm = pendingManagerPublicKeyOrUnit()
997- let hasPM = if (isDefined(pm))
998- then true
999- else throw("No pending manager")
1000- if ((hasPM == hasPM))
1001- then {
1002- let checkPM = if ((i.callerPublicKey == value(pm)))
1003- then true
1004- else throw("You are not pending manager")
1005- if ((checkPM == checkPM))
1006- then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
1007- else throw("Strict value is not equal to itself.")
1008- }
1009- else throw("Strict value is not equal to itself.")
1010- }
1011-
1012-
1013-
1014-@Callable(i)
1015997 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
1016998 then throw("Invalid slippageTolerance passed")
1017999 else {
10181000 let estPut = commonPut(i, slippageTolerance, true)
10191001 let emitLpAmt = estPut._2
10201002 let lpAssetId = estPut._7
10211003 let state = estPut._9
10221004 let amDiff = estPut._10
10231005 let prDiff = estPut._11
10241006 let amId = estPut._12
10251007 let prId = estPut._13
10261008 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10271009 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10281010 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10291011 if ((currentKLp == currentKLp))
10301012 then {
10311013 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
10321014 if ((emitInv == emitInv))
10331015 then {
10341016 let emitInvLegacy = match emitInv {
10351017 case legacyFactoryContract: Address =>
10361018 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
10371019 case _ =>
10381020 unit
10391021 }
10401022 if ((emitInvLegacy == emitInvLegacy))
10411023 then {
10421024 let slippageAInv = if ((amDiff > 0))
10431025 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
10441026 else nil
10451027 if ((slippageAInv == slippageAInv))
10461028 then {
10471029 let slippagePInv = if ((prDiff > 0))
10481030 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
10491031 else nil
10501032 if ((slippagePInv == slippagePInv))
10511033 then {
10521034 let lpTransfer = if (shouldAutoStake)
10531035 then {
10541036 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
10551037 if ((slpStakeInv == slpStakeInv))
10561038 then nil
10571039 else throw("Strict value is not equal to itself.")
10581040 }
10591041 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
1060- let $t04447644938 = refreshKLpInternal(0, 0, 0)
1061- if (($t04447644938 == $t04447644938))
1042+ let $t04436144823 = refreshKLpInternal(0, 0, 0)
1043+ if (($t04436144823 == $t04436144823))
10621044 then {
1063- let updatedKLp = $t04447644938._2
1064- let refreshKLpActions = $t04447644938._1
1045+ let updatedKLp = $t04436144823._2
1046+ let refreshKLpActions = $t04436144823._1
10651047 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10661048 if ((isUpdatedKLpValid == isUpdatedKLpValid))
10671049 then {
10681050 let reb = invoke(this, "rebalance", nil, nil)
10691051 if ((reb == reb))
10701052 then ((state ++ lpTransfer) ++ refreshKLpActions)
10711053 else throw("Strict value is not equal to itself.")
10721054 }
10731055 else throw("Strict value is not equal to itself.")
10741056 }
10751057 else throw("Strict value is not equal to itself.")
10761058 }
10771059 else throw("Strict value is not equal to itself.")
10781060 }
10791061 else throw("Strict value is not equal to itself.")
10801062 }
10811063 else throw("Strict value is not equal to itself.")
10821064 }
10831065 else throw("Strict value is not equal to itself.")
10841066 }
10851067 else throw("Strict value is not equal to itself.")
10861068 }
10871069
10881070
10891071
10901072 @Callable(i)
10911073 func putForFree (maxSlippage) = if ((0 > maxSlippage))
10921074 then throw("Invalid value passed")
10931075 else {
10941076 let estPut = commonPut(i, maxSlippage, false)
10951077 let state = estPut._9
10961078 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
10971079 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
10981080 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
10991081 if ((currentKLp == currentKLp))
11001082 then {
1101- let $t04555045615 = refreshKLpInternal(0, 0, 0)
1102- let refreshKLpActions = $t04555045615._1
1103- let updatedKLp = $t04555045615._2
1083+ let $t04543545500 = refreshKLpInternal(0, 0, 0)
1084+ let refreshKLpActions = $t04543545500._1
1085+ let updatedKLp = $t04543545500._2
11041086 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11051087 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11061088 then (state ++ refreshKLpActions)
11071089 else throw("Strict value is not equal to itself.")
11081090 }
11091091 else throw("Strict value is not equal to itself.")
11101092 }
11111093
11121094
11131095
11141096 @Callable(i)
11151097 func putOneTkn (minOutAmount,autoStake) = {
11161098 let isPoolOneTokenOperationsDisabled = {
11171099 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11181100 if ($isInstanceOf(@, "Boolean"))
11191101 then @
11201102 else throw(($getType(@) + " couldn't be cast to Boolean"))
11211103 }
11221104 let isPutDisabled = if (if (if (isGlobalShutdown())
11231105 then true
11241106 else (cfgPoolStatus == PoolPutDisabled))
11251107 then true
11261108 else (cfgPoolStatus == PoolShutdown))
11271109 then true
11281110 else isPoolOneTokenOperationsDisabled
11291111 let checks = [if (if (!(isPutDisabled))
11301112 then true
11311113 else isManager(i))
11321114 then true
11331115 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
11341116 then true
11351117 else throwErr("exactly 1 payment are expected")]
11361118 if ((checks == checks))
11371119 then {
11381120 let payment = i.payments[0]
11391121 let paymentAssetId = payment.assetId
11401122 let paymentAmountRaw = payment.amount
11411123 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
11421124 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
11431125 else if ((paymentAssetId == cfgPriceAssetId))
11441126 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
11451127 else throwErr("payment asset is not supported")
11461128 if ((currentKLp == currentKLp))
11471129 then {
11481130 let userAddress = i.caller
11491131 let txId = i.transactionId
1150- let $t04680346955 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1151- if (($t04680346955 == $t04680346955))
1132+ let $t04668846840 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1133+ if (($t04668846840 == $t04668846840))
11521134 then {
1153- let paymentInAmountAsset = $t04680346955._5
1154- let bonus = $t04680346955._4
1155- let feeAmount = $t04680346955._3
1156- let commonState = $t04680346955._2
1157- let emitAmountEstimated = $t04680346955._1
1135+ let paymentInAmountAsset = $t04668846840._5
1136+ let bonus = $t04668846840._4
1137+ let feeAmount = $t04668846840._3
1138+ let commonState = $t04668846840._2
1139+ let emitAmountEstimated = $t04668846840._1
11581140 let emitAmount = if (if ((minOutAmount > 0))
11591141 then (minOutAmount > emitAmountEstimated)
11601142 else false)
11611143 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
11621144 else emitAmountEstimated
11631145 let emitInv = emit(emitAmount)
11641146 if ((emitInv == emitInv))
11651147 then {
11661148 let lpTransfer = if (autoStake)
11671149 then {
11681150 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
11691151 if ((stakeInv == stakeInv))
11701152 then nil
11711153 else throw("Strict value is not equal to itself.")
11721154 }
11731155 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
11741156 let sendFee = if ((feeAmount > 0))
11751157 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
11761158 else nil
1177- let $t04754147738 = if ((this == feeCollectorAddress))
1159+ let $t04742647623 = if ((this == feeCollectorAddress))
11781160 then $Tuple2(0, 0)
11791161 else if (paymentInAmountAsset)
11801162 then $Tuple2(-(feeAmount), 0)
11811163 else $Tuple2(0, -(feeAmount))
1182- let amountAssetBalanceDelta = $t04754147738._1
1183- let priceAssetBalanceDelta = $t04754147738._2
1184- let $t04774147849 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1185- let refreshKLpActions = $t04774147849._1
1186- let updatedKLp = $t04774147849._2
1164+ let amountAssetBalanceDelta = $t04742647623._1
1165+ let priceAssetBalanceDelta = $t04742647623._2
1166+ let $t04762647734 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1167+ let refreshKLpActions = $t04762647734._1
1168+ let updatedKLp = $t04762647734._2
11871169 let kLp = value(getString(keyKLp))
11881170 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11891171 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11901172 then {
11911173 let reb = invoke(this, "rebalance", nil, nil)
11921174 if ((reb == reb))
11931175 then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
11941176 else throw("Strict value is not equal to itself.")
11951177 }
11961178 else throw("Strict value is not equal to itself.")
11971179 }
11981180 else throw("Strict value is not equal to itself.")
11991181 }
12001182 else throw("Strict value is not equal to itself.")
12011183 }
12021184 else throw("Strict value is not equal to itself.")
12031185 }
12041186 else throw("Strict value is not equal to itself.")
12051187 }
12061188
12071189
12081190
12091191 @Callable(i)
12101192 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
1211- let $t04820448361 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1212- let emitAmountEstimated = $t04820448361._1
1213- let commonState = $t04820448361._2
1214- let feeAmount = $t04820448361._3
1215- let bonus = $t04820448361._4
1216- let paymentInAmountAsset = $t04820448361._5
1193+ let $t04808948246 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1194+ let emitAmountEstimated = $t04808948246._1
1195+ let commonState = $t04808948246._2
1196+ let feeAmount = $t04808948246._3
1197+ let bonus = $t04808948246._4
1198+ let paymentInAmountAsset = $t04808948246._5
12171199 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
12181200 }
12191201
12201202
12211203
12221204 @Callable(i)
12231205 func getOneTkn (outAssetIdStr,minOutAmount) = {
12241206 let isPoolOneTokenOperationsDisabled = {
12251207 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
12261208 if ($isInstanceOf(@, "Boolean"))
12271209 then @
12281210 else throw(($getType(@) + " couldn't be cast to Boolean"))
12291211 }
12301212 let isGetDisabled = if (if (isGlobalShutdown())
12311213 then true
12321214 else (cfgPoolStatus == PoolShutdown))
12331215 then true
12341216 else isPoolOneTokenOperationsDisabled
12351217 let checks = [if (if (!(isGetDisabled))
12361218 then true
12371219 else isManager(i))
12381220 then true
12391221 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
12401222 then true
12411223 else throwErr("exactly 1 payment are expected")]
12421224 if ((checks == checks))
12431225 then {
12441226 let outAssetId = parseAssetId(outAssetIdStr)
12451227 let payment = i.payments[0]
12461228 let paymentAssetId = payment.assetId
12471229 let paymentAmount = payment.amount
12481230 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12491231 if ((currentKLp == currentKLp))
12501232 then {
12511233 let userAddress = i.caller
12521234 let txId = i.transactionId
1253- let $t04924649399 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1254- if (($t04924649399 == $t04924649399))
1235+ let $t04913149284 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1236+ if (($t04913149284 == $t04913149284))
12551237 then {
1256- let outInAmountAsset = $t04924649399._5
1257- let bonus = $t04924649399._4
1258- let feeAmount = $t04924649399._3
1259- let commonState = $t04924649399._2
1260- let amountEstimated = $t04924649399._1
1238+ let outInAmountAsset = $t04913149284._5
1239+ let bonus = $t04913149284._4
1240+ let feeAmount = $t04913149284._3
1241+ let commonState = $t04913149284._2
1242+ let amountEstimated = $t04913149284._1
12611243 let amount = if (if ((minOutAmount > 0))
12621244 then (minOutAmount > amountEstimated)
12631245 else false)
12641246 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
12651247 else amountEstimated
12661248 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
12671249 if ((burnInv == burnInv))
12681250 then {
12691251 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
12701252 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
12711253 let sendFee = if ((feeAmount > 0))
12721254 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
12731255 else nil
1274- let $t05006350310 = {
1256+ let $t04994850195 = {
12751257 let feeAmountForCalc = if ((this == feeCollectorAddress))
12761258 then 0
12771259 else feeAmount
12781260 if (outInAmountAsset)
12791261 then $Tuple2(-((amount + feeAmountForCalc)), 0)
12801262 else $Tuple2(0, -((amount + feeAmountForCalc)))
12811263 }
1282- let amountAssetBalanceDelta = $t05006350310._1
1283- let priceAssetBalanceDelta = $t05006350310._2
1284- let $t05031350421 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1285- let refreshKLpActions = $t05031350421._1
1286- let updatedKLp = $t05031350421._2
1264+ let amountAssetBalanceDelta = $t04994850195._1
1265+ let priceAssetBalanceDelta = $t04994850195._2
1266+ let $t05019850306 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1267+ let refreshKLpActions = $t05019850306._1
1268+ let updatedKLp = $t05019850306._2
12871269 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12881270 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12891271 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
12901272 else throw("Strict value is not equal to itself.")
12911273 }
12921274 else throw("Strict value is not equal to itself.")
12931275 }
12941276 else throw("Strict value is not equal to itself.")
12951277 }
12961278 else throw("Strict value is not equal to itself.")
12971279 }
12981280 else throw("Strict value is not equal to itself.")
12991281 }
13001282
13011283
13021284
13031285 @Callable(i)
13041286 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1305- let $t05069950855 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1306- let amountEstimated = $t05069950855._1
1307- let commonState = $t05069950855._2
1308- let feeAmount = $t05069950855._3
1309- let bonus = $t05069950855._4
1310- let outInAmountAsset = $t05069950855._5
1287+ let $t05058450740 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1288+ let amountEstimated = $t05058450740._1
1289+ let commonState = $t05058450740._2
1290+ let feeAmount = $t05058450740._3
1291+ let bonus = $t05058450740._4
1292+ let outInAmountAsset = $t05058450740._5
13111293 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
13121294 }
13131295
13141296
13151297
13161298 @Callable(i)
13171299 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
13181300 let isPoolOneTokenOperationsDisabled = {
13191301 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
13201302 if ($isInstanceOf(@, "Boolean"))
13211303 then @
13221304 else throw(($getType(@) + " couldn't be cast to Boolean"))
13231305 }
13241306 let isGetDisabled = if (if (isGlobalShutdown())
13251307 then true
13261308 else (cfgPoolStatus == PoolShutdown))
13271309 then true
13281310 else isPoolOneTokenOperationsDisabled
13291311 let checks = [if (if (!(isGetDisabled))
13301312 then true
13311313 else isManager(i))
13321314 then true
13331315 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
13341316 then true
13351317 else throwErr("no payments are expected")]
13361318 if ((checks == checks))
13371319 then {
13381320 let outAssetId = parseAssetId(outAssetIdStr)
13391321 let userAddress = i.caller
13401322 let txId = i.transactionId
13411323 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13421324 if ((currentKLp == currentKLp))
13431325 then {
13441326 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13451327 if ((unstakeInv == unstakeInv))
13461328 then {
1347- let $t05176051911 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1348- if (($t05176051911 == $t05176051911))
1329+ let $t05164551796 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1330+ if (($t05164551796 == $t05164551796))
13491331 then {
1350- let outInAmountAsset = $t05176051911._5
1351- let bonus = $t05176051911._4
1352- let feeAmount = $t05176051911._3
1353- let commonState = $t05176051911._2
1354- let amountEstimated = $t05176051911._1
1332+ let outInAmountAsset = $t05164551796._5
1333+ let bonus = $t05164551796._4
1334+ let feeAmount = $t05164551796._3
1335+ let commonState = $t05164551796._2
1336+ let amountEstimated = $t05164551796._1
13551337 let amount = if (if ((minOutAmount > 0))
13561338 then (minOutAmount > amountEstimated)
13571339 else false)
13581340 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
13591341 else amountEstimated
13601342 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13611343 if ((burnInv == burnInv))
13621344 then {
13631345 let withdrawState = withdrawAndRebalanceAsset(outAssetIdStr, (amount + max([0, feeAmount])))
13641346 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
13651347 let sendFee = if ((feeAmount > 0))
13661348 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
13671349 else nil
1368- let $t05257052817 = {
1350+ let $t05245552702 = {
13691351 let feeAmountForCalc = if ((this == feeCollectorAddress))
13701352 then 0
13711353 else feeAmount
13721354 if (outInAmountAsset)
13731355 then $Tuple2(-((amount + feeAmountForCalc)), 0)
13741356 else $Tuple2(0, -((amount + feeAmountForCalc)))
13751357 }
1376- let amountAssetBalanceDelta = $t05257052817._1
1377- let priceAssetBalanceDelta = $t05257052817._2
1378- let $t05282052928 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1379- let refreshKLpActions = $t05282052928._1
1380- let updatedKLp = $t05282052928._2
1358+ let amountAssetBalanceDelta = $t05245552702._1
1359+ let priceAssetBalanceDelta = $t05245552702._2
1360+ let $t05270552813 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1361+ let refreshKLpActions = $t05270552813._1
1362+ let updatedKLp = $t05270552813._2
13811363 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13821364 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13831365 then $Tuple2(((((commonState ++ withdrawState) ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
13841366 else throw("Strict value is not equal to itself.")
13851367 }
13861368 else throw("Strict value is not equal to itself.")
13871369 }
13881370 else throw("Strict value is not equal to itself.")
13891371 }
13901372 else throw("Strict value is not equal to itself.")
13911373 }
13921374 else throw("Strict value is not equal to itself.")
13931375 }
13941376 else throw("Strict value is not equal to itself.")
13951377 }
13961378
13971379
13981380
13991381 @Callable(i)
14001382 func get () = {
14011383 let res = commonGet(i)
14021384 let outAmAmt = res._1
14031385 let outPrAmt = res._2
14041386 let pmtAmt = res._3
14051387 let pmtAssetId = res._4
14061388 let state = res._5
14071389 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14081390 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14091391 if ((currentKLp == currentKLp))
14101392 then {
14111393 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14121394 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14131395 then {
1414- let $t05402354104 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1415- let refreshKLpActions = $t05402354104._1
1416- let updatedKLp = $t05402354104._2
1396+ let $t05390853989 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1397+ let refreshKLpActions = $t05390853989._1
1398+ let updatedKLp = $t05390853989._2
14171399 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14181400 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14191401 then ((withdrawState ++ state) ++ refreshKLpActions)
14201402 else throw("Strict value is not equal to itself.")
14211403 }
14221404 else throw("Strict value is not equal to itself.")
14231405 }
14241406 else throw("Strict value is not equal to itself.")
14251407 }
14261408
14271409
14281410
14291411 @Callable(i)
14301412 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
14311413 let res = commonGet(i)
14321414 let outAmAmt = res._1
14331415 let outPrAmt = res._2
14341416 let pmtAmt = res._3
14351417 let pmtAssetId = res._4
14361418 let state = res._5
14371419 if ((noLessThenAmtAsset > outAmAmt))
14381420 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
14391421 else if ((noLessThenPriceAsset > outPrAmt))
14401422 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
14411423 else {
14421424 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14431425 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14441426 if ((currentKLp == currentKLp))
14451427 then {
14461428 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
14471429 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14481430 then {
1449- let $t05519955280 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1450- let refreshKLpActions = $t05519955280._1
1451- let updatedKLp = $t05519955280._2
1431+ let $t05508455165 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1432+ let refreshKLpActions = $t05508455165._1
1433+ let updatedKLp = $t05508455165._2
14521434 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
14531435 if ((isUpdatedKLpValid == isUpdatedKLpValid))
14541436 then ((withdrawState ++ state) ++ refreshKLpActions)
14551437 else throw("Strict value is not equal to itself.")
14561438 }
14571439 else throw("Strict value is not equal to itself.")
14581440 }
14591441 else throw("Strict value is not equal to itself.")
14601442 }
14611443 }
14621444
14631445
14641446
14651447 @Callable(i)
14661448 func unstakeAndGet (amount) = {
14671449 let checkPayments = if ((size(i.payments) != 0))
14681450 then throw("No payments are expected")
14691451 else true
14701452 if ((checkPayments == checkPayments))
14711453 then {
14721454 let cfg = getPoolConfig()
14731455 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
14741456 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
14751457 if ((currentKLp == currentKLp))
14761458 then {
14771459 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
14781460 if ((unstakeInv == unstakeInv))
14791461 then {
14801462 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
14811463 let outAmAmt = res._1
14821464 let outPrAmt = res._2
14831465 let poolStatus = parseIntValue(res._9)
14841466 let state = res._10
14851467 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
14861468 let checkPoolStatus = if (if (isGlobalShutdown())
14871469 then true
14881470 else (poolStatus == PoolShutdown))
14891471 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
14901472 else true
14911473 if ((checkPoolStatus == checkPoolStatus))
14921474 then {
14931475 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
14941476 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
14951477 then {
1496- let $t05655256633 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1497- let refreshKLpActions = $t05655256633._1
1498- let updatedKLp = $t05655256633._2
1478+ let $t05643756518 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1479+ let refreshKLpActions = $t05643756518._1
1480+ let updatedKLp = $t05643756518._2
14991481 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15001482 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15011483 then ((withdrawState ++ state) ++ refreshKLpActions)
15021484 else throw("Strict value is not equal to itself.")
15031485 }
15041486 else throw("Strict value is not equal to itself.")
15051487 }
15061488 else throw("Strict value is not equal to itself.")
15071489 }
15081490 else throw("Strict value is not equal to itself.")
15091491 }
15101492 else throw("Strict value is not equal to itself.")
15111493 }
15121494 else throw("Strict value is not equal to itself.")
15131495 }
15141496
15151497
15161498
15171499 @Callable(i)
15181500 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
15191501 let isGetDisabled = if (isGlobalShutdown())
15201502 then true
15211503 else (cfgPoolStatus == PoolShutdown)
15221504 let checks = [if (!(isGetDisabled))
15231505 then true
15241506 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
15251507 then true
15261508 else throw("no payments are expected")]
15271509 if ((checks == checks))
15281510 then {
15291511 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
15301512 if ((currentKLp == currentKLp))
15311513 then {
15321514 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
15331515 if ((unstakeInv == unstakeInv))
15341516 then {
15351517 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
15361518 let outAmAmt = res._1
15371519 let outPrAmt = res._2
15381520 let state = res._10
15391521 let withdrawState = withdrawAndRebalanceAll(outAmAmt, outPrAmt)
15401522 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
15411523 then true
15421524 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
15431525 then true
15441526 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
15451527 if ((checkAmounts == checkAmounts))
15461528 then {
15471529 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
15481530 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
15491531 then {
1550- let $t05807458155 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1551- let refreshKLpActions = $t05807458155._1
1552- let updatedKLp = $t05807458155._2
1532+ let $t05795958040 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1533+ let refreshKLpActions = $t05795958040._1
1534+ let updatedKLp = $t05795958040._2
15531535 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
15541536 if ((isUpdatedKLpValid == isUpdatedKLpValid))
15551537 then ((withdrawState ++ state) ++ refreshKLpActions)
15561538 else throw("Strict value is not equal to itself.")
15571539 }
15581540 else throw("Strict value is not equal to itself.")
15591541 }
15601542 else throw("Strict value is not equal to itself.")
15611543 }
15621544 else throw("Strict value is not equal to itself.")
15631545 }
15641546 else throw("Strict value is not equal to itself.")
15651547 }
15661548 else throw("Strict value is not equal to itself.")
15671549 }
15681550
15691551
15701552
15711553 @Callable(i)
15721554 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
15731555 then throw("permissions denied")
15741556 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
15751557
15761558
15771559
15781560 @Callable(i)
15791561 func refreshKLp () = {
15801562 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
15811563 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
15821564 then unit
15831565 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
15841566 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
15851567 then {
15861568 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1587- let $t05935959423 = refreshKLpInternal(0, 0, 0)
1588- let kLpUpdateActions = $t05935959423._1
1589- let updatedKLp = $t05935959423._2
1569+ let $t05924459308 = refreshKLpInternal(0, 0, 0)
1570+ let kLpUpdateActions = $t05924459308._1
1571+ let updatedKLp = $t05924459308._2
15901572 let actions = if ((kLp != updatedKLp))
15911573 then kLpUpdateActions
15921574 else throwErr("nothing to refresh")
15931575 $Tuple2(actions, toString(updatedKLp))
15941576 }
15951577 else throw("Strict value is not equal to itself.")
15961578 }
15971579
15981580
15991581
16001582 @Callable(i)
16011583 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
16021584
16031585
16041586
16051587 @Callable(i)
16061588 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
16071589
16081590
16091591
16101592 @Callable(i)
16111593 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
16121594 let prices = calcPrices(amAmt, prAmt, lpAmt)
16131595 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
16141596 }
16151597
16161598
16171599
16181600 @Callable(i)
16191601 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
16201602
16211603
16221604
16231605 @Callable(i)
16241606 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
16251607
16261608
16271609
16281610 @Callable(i)
16291611 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
16301612
16311613
16321614
16331615 @Callable(i)
16341616 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
16351617
16361618
16371619
16381620 @Callable(i)
16391621 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
16401622 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
16411623 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
16421624 }
16431625
16441626
16451627
16461628 @Callable(i)
16471629 func statsREADONLY () = {
16481630 let cfg = getPoolConfig()
16491631 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16501632 let amtAssetId = cfg[idxAmtAssetId]
16511633 let priceAssetId = cfg[idxPriceAssetId]
16521634 let iAmtAssetId = cfg[idxIAmtAssetId]
16531635 let iPriceAssetId = cfg[idxIPriceAssetId]
16541636 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16551637 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16561638 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16571639 let accAmtAssetBalance = getAccBalance(amtAssetId)
16581640 let accPriceAssetBalance = getAccBalance(priceAssetId)
16591641 let pricesList = if ((poolLPBalance == 0))
16601642 then [zeroBigInt, zeroBigInt, zeroBigInt]
16611643 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
16621644 let curPrice = 0
16631645 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
16641646 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
16651647 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
16661648 $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))
16671649 }
16681650
16691651
16701652
16711653 @Callable(i)
16721654 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
16731655 let cfg = getPoolConfig()
16741656 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
16751657 let amAssetIdStr = cfg[idxAmtAssetId]
16761658 let amAssetId = fromBase58String(amAssetIdStr)
16771659 let prAssetIdStr = cfg[idxPriceAssetId]
16781660 let prAssetId = fromBase58String(prAssetIdStr)
16791661 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
16801662 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
16811663 let poolStatus = cfg[idxPoolStatus]
16821664 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
16831665 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
16841666 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
16851667 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
16861668 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
16871669 let curPriceX18 = if ((poolLPBalance == 0))
16881670 then zeroBigInt
16891671 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
16901672 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
16911673 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
16921674 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
16931675 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
16941676 let calcLpAmt = estPut._1
16951677 let curPriceCalc = estPut._3
16961678 let amBalance = estPut._4
16971679 let prBalance = estPut._5
16981680 let lpEmission = estPut._6
16991681 $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))
17001682 }
17011683
17021684
17031685
17041686 @Callable(i)
17051687 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
17061688 let cfg = getPoolConfig()
17071689 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
17081690 let amAssetIdStr = cfg[idxAmtAssetId]
17091691 let amAssetId = fromBase58String(amAssetIdStr)
17101692 let prAssetIdStr = cfg[idxPriceAssetId]
17111693 let prAssetId = fromBase58String(prAssetIdStr)
17121694 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
17131695 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
17141696 let poolStatus = cfg[idxPoolStatus]
17151697 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
17161698 let amBalanceRaw = getAccBalance(amAssetIdStr)
17171699 let prBalanceRaw = getAccBalance(prAssetIdStr)
17181700 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
17191701 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
17201702 let curPriceX18 = if ((poolLPBalance == 0))
17211703 then zeroBigInt
17221704 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
17231705 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
17241706 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
17251707 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
17261708 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
17271709 let calcLpAmt = estPut._1
17281710 let curPriceCalc = estPut._3
17291711 let amBalance = estPut._4
17301712 let prBalance = estPut._5
17311713 let lpEmission = estPut._6
17321714 $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))
17331715 }
17341716
17351717
17361718
17371719 @Callable(i)
17381720 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
17391721 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
17401722 let outAmAmt = res._1
17411723 let outPrAmt = res._2
17421724 let amBalance = res._5
17431725 let prBalance = res._6
17441726 let lpEmission = res._7
17451727 let curPrice = res._8
17461728 let poolStatus = parseIntValue(res._9)
17471729 $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))
17481730 }
17491731
17501732
17511733 @Verifier(tx)
17521734 func verify () = {
17531735 let targetPublicKey = match managerPublicKeyOrUnit() {
17541736 case pk: ByteVector =>
17551737 pk
17561738 case _: Unit =>
17571739 tx.senderPublicKey
17581740 case _ =>
17591741 throw("Match error")
17601742 }
17611743 match tx {
17621744 case order: Order =>
17631745 let matcherPub = getMatcherPubOrFail()
1764- let $t06808568202 = if (skipOrderValidation())
1746+ let $t06797068087 = if (skipOrderValidation())
17651747 then $Tuple2(true, "")
17661748 else validateMatcherOrderAllowed(order)
1767- let orderValid = $t06808568202._1
1768- let orderValidInfo = $t06808568202._2
1749+ let orderValid = $t06797068087._1
1750+ let orderValidInfo = $t06797068087._2
17691751 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
17701752 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
17711753 if (if (if (orderValid)
17721754 then senderValid
17731755 else false)
17741756 then matcherValid
17751757 else false)
17761758 then true
17771759 else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid)
17781760 case s: SetScriptTransaction =>
17791761 if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey))
17801762 then true
17811763 else {
17821764 let newHash = blake2b256(value(s.script))
17831765 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
17841766 let currentHash = scriptHash(this)
17851767 if ((allowedHash == newHash))
17861768 then (currentHash != newHash)
17871769 else false
17881770 }
17891771 case _ =>
17901772 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
17911773 }
17921774 }
17931775

github/deemru/w8io/026f985 
242.98 ms