tx · ETBDUffvCQ52TJhx7QgEZAdRLDQ6y8XDZQi7bu5GKZ8t

3N74GDduMoMAhHk7dApH6P9VDWKhFZ417FD:  -0.04200000 Waves

2023.05.10 13:09 [2571649] smart account 3N74GDduMoMAhHk7dApH6P9VDWKhFZ417FD > SELF 0.00000000 Waves

{ "type": 13, "id": "ETBDUffvCQ52TJhx7QgEZAdRLDQ6y8XDZQi7bu5GKZ8t", "fee": 4200000, "feeAssetId": null, "timestamp": 1683713402340, "version": 2, "chainId": 84, "sender": "3N74GDduMoMAhHk7dApH6P9VDWKhFZ417FD", "senderPublicKey": "C94AxUmoNDGMx49Ry1Q3s6UNv8WgGMUeBb6zhLbfFk8v", "proofs": [ "5yK8AotiW7KFmUkQ3YYnAyt6eqsFhjViX8i2BvdPG6LTp2hL1SyVxEnZUwDu5VjDxr9MBvia77A8zFxU79yc3RKM" ], "script": "base64:BgKSOAgCEgASBQoDAQQBEgcKBQEEAQgBEgQKAgEEEgMKAQESBAoCAQQSBAoCCAESBAoCCAESBAoCCAESBQoDAQgBEgASBAoCAQESAwoBARIFCgMBAQESBAoCCAgSABIAEgMKAQgSBQoDAQEBEgQKAgEBEgQKAggBEgQKAggIEgsKCQgBAQIBAggEBBIGCgQICAEIEgASAwoBARIDCgEBEgQKAggBIgpsUGRlY2ltYWxzIgZzY2FsZTgiDHNjYWxlOEJpZ0ludCIHc2NhbGUxOCIKemVyb0JpZ0ludCIEYmlnMCIEYmlnMSIEYmlnMiILd2F2ZXNTdHJpbmciA1NFUCIKUG9vbEFjdGl2ZSIPUG9vbFB1dERpc2FibGVkIhNQb29sTWF0Y2hlckRpc2FibGVkIgxQb29sU2h1dGRvd24iDmlkeFBvb2xBZGRyZXNzIg1pZHhQb29sU3RhdHVzIhBpZHhQb29sTFBBc3NldElkIg1pZHhBbXRBc3NldElkIg9pZHhQcmljZUFzc2V0SWQiDmlkeEFtdEFzc2V0RGNtIhBpZHhQcmljZUFzc2V0RGNtIg5pZHhJQW10QXNzZXRJ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
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 addressFromStringOrThis(fc()) {
187+ case fca: Address =>
188+ 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 $t095199685 = poolConfigParsed
238262
239-let cfgPoolAddress = $t090589224._1
263+let cfgPoolAddress = $t095199685._1
240264
241-let cfgPoolStatus = $t090589224._2
265+let cfgPoolStatus = $t095199685._2
242266
243-let cfgLpAssetId = $t090589224._3
267+let cfgLpAssetId = $t095199685._3
244268
245-let cfgAmountAssetId = $t090589224._4
269+let cfgAmountAssetId = $t095199685._4
246270
247-let cfgPriceAssetId = $t090589224._5
271+let cfgPriceAssetId = $t095199685._5
248272
249-let cfgAmountAssetDecimals = $t090589224._6
273+let cfgAmountAssetDecimals = $t095199685._6
250274
251-let cfgPriceAssetDecimals = $t090589224._7
275+let cfgPriceAssetDecimals = $t095199685._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 $t01592116057 = getLeaseProxyConfig(assetId)
425+ let isLeasable = $t01592116057._1
426+ let leasedRatio = $t01592116057._2
427+ let minBalance = $t01592116057._3
428+ let proxyAddress = $t01592116057._4
429+ let proxyAssetId = $t01592116057._5
430+ let proxyRateMul = $t01592116057._6
431+ let stakingProfitAddress = $t01592116057._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 $t01645616592 = getLeaseProxyConfig(assetId)
440+ let isLeasable = $t01645616592._1
441+ let leasedRatio = $t01645616592._2
442+ let minBalance = $t01645616592._3
443+ let proxyAddress = $t01645616592._4
444+ let proxyAssetId = $t01645616592._5
445+ let proxyRateMul = $t01645616592._6
446+ let stakingProfitAddress = $t01645616592._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 $t02898129193 = 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 = $t02898129193._1
663+ let priceAssetBalanceDelta = $t02898129193._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 $t02963329733 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
677+ let unusedActions = $t02963329733._1
678+ let kLpNew = $t02963329733._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 $t03284633139 = 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 = $t03284633139._1
763+ let priceBalanceOld = $t03284633139._2
764+ let $t03314333292 = 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 = $t03314333292._1
768+ let priceAssetAmountRaw = $t03314333292._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 $t03342433488 = takeFee(paymentAmountRaw, inFee)
772+ let paymentAmount = $t03342433488._1
773+ let feeAmount = $t03342433488._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 $t03516935336 = 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 = $t03516935336._1
800+ let balance = $t03516935336._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 $t03741437470 = takeFee(amountRaw, outFee)
841+ let totalAmount = $t03741437470._1
842+ let feeAmount = $t03741437470._2
843+ let $t03747437700 = 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 = $t03747437700._1
847+ let outPrAmount = $t03747437700._2
848+ let amBalanceNew = $t03747437700._3
849+ let prBalanceNew = $t03747437700._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 $t03955939864 = 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 = $t03955939864._1
926+ let assetIn = $t03955939864._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 $t04435144813 = refreshKLpInternal(0, 0, 0)
1043+ if (($t04435144813 == $t04435144813))
10621044 then {
1063- let updatedKLp = $t04447644938._2
1064- let refreshKLpActions = $t04447644938._1
1045+ let updatedKLp = $t04435144813._2
1046+ let refreshKLpActions = $t04435144813._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 $t04542545490 = refreshKLpInternal(0, 0, 0)
1084+ let refreshKLpActions = $t04542545490._1
1085+ let updatedKLp = $t04542545490._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 $t04667846830 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1133+ if (($t04667846830 == $t04667846830))
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 = $t04667846830._5
1136+ let bonus = $t04667846830._4
1137+ let feeAmount = $t04667846830._3
1138+ let commonState = $t04667846830._2
1139+ let emitAmountEstimated = $t04667846830._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 $t04741647613 = 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 = $t04741647613._1
1165+ let priceAssetBalanceDelta = $t04741647613._2
1166+ let $t04761647724 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1167+ let refreshKLpActions = $t04761647724._1
1168+ let updatedKLp = $t04761647724._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 $t04807948236 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1194+ let emitAmountEstimated = $t04807948236._1
1195+ let commonState = $t04807948236._2
1196+ let feeAmount = $t04807948236._3
1197+ let bonus = $t04807948236._4
1198+ let paymentInAmountAsset = $t04807948236._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 $t04912149274 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1236+ if (($t04912149274 == $t04912149274))
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 = $t04912149274._5
1239+ let bonus = $t04912149274._4
1240+ let feeAmount = $t04912149274._3
1241+ let commonState = $t04912149274._2
1242+ let amountEstimated = $t04912149274._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 $t04993850185 = {
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 = $t04993850185._1
1265+ let priceAssetBalanceDelta = $t04993850185._2
1266+ let $t05018850296 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1267+ let refreshKLpActions = $t05018850296._1
1268+ let updatedKLp = $t05018850296._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 $t05057450730 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1288+ let amountEstimated = $t05057450730._1
1289+ let commonState = $t05057450730._2
1290+ let feeAmount = $t05057450730._3
1291+ let bonus = $t05057450730._4
1292+ let outInAmountAsset = $t05057450730._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 $t05163551786 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1330+ if (($t05163551786 == $t05163551786))
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 = $t05163551786._5
1333+ let bonus = $t05163551786._4
1334+ let feeAmount = $t05163551786._3
1335+ let commonState = $t05163551786._2
1336+ let amountEstimated = $t05163551786._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 $t05244552692 = {
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 = $t05244552692._1
1359+ let priceAssetBalanceDelta = $t05244552692._2
1360+ let $t05269552803 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1361+ let refreshKLpActions = $t05269552803._1
1362+ let updatedKLp = $t05269552803._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 $t05389853979 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1397+ let refreshKLpActions = $t05389853979._1
1398+ let updatedKLp = $t05389853979._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 $t05507455155 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1432+ let refreshKLpActions = $t05507455155._1
1433+ let updatedKLp = $t05507455155._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 $t05642756508 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1479+ let refreshKLpActions = $t05642756508._1
1480+ let updatedKLp = $t05642756508._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 $t05794958030 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1533+ let refreshKLpActions = $t05794958030._1
1534+ let updatedKLp = $t05794958030._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 $t05923459298 = refreshKLpInternal(0, 0, 0)
1570+ let kLpUpdateActions = $t05923459298._1
1571+ let updatedKLp = $t05923459298._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 $t06796068077 = if (skipOrderValidation())
17651747 then $Tuple2(true, "")
17661748 else validateMatcherOrderAllowed(order)
1767- let orderValid = $t06808568202._1
1768- let orderValidInfo = $t06808568202._2
1749+ let orderValid = $t06796068077._1
1750+ let orderValidInfo = $t06796068077._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 addressFromStringOrThis(fc()) {
187+ case fca: Address =>
188+ 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 $t095199685 = poolConfigParsed
238262
239-let cfgPoolAddress = $t090589224._1
263+let cfgPoolAddress = $t095199685._1
240264
241-let cfgPoolStatus = $t090589224._2
265+let cfgPoolStatus = $t095199685._2
242266
243-let cfgLpAssetId = $t090589224._3
267+let cfgLpAssetId = $t095199685._3
244268
245-let cfgAmountAssetId = $t090589224._4
269+let cfgAmountAssetId = $t095199685._4
246270
247-let cfgPriceAssetId = $t090589224._5
271+let cfgPriceAssetId = $t095199685._5
248272
249-let cfgAmountAssetDecimals = $t090589224._6
273+let cfgAmountAssetDecimals = $t095199685._6
250274
251-let cfgPriceAssetDecimals = $t090589224._7
275+let cfgPriceAssetDecimals = $t095199685._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 $t01592116057 = getLeaseProxyConfig(assetId)
425+ let isLeasable = $t01592116057._1
426+ let leasedRatio = $t01592116057._2
427+ let minBalance = $t01592116057._3
428+ let proxyAddress = $t01592116057._4
429+ let proxyAssetId = $t01592116057._5
430+ let proxyRateMul = $t01592116057._6
431+ let stakingProfitAddress = $t01592116057._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 $t01645616592 = getLeaseProxyConfig(assetId)
440+ let isLeasable = $t01645616592._1
441+ let leasedRatio = $t01645616592._2
442+ let minBalance = $t01645616592._3
443+ let proxyAddress = $t01645616592._4
444+ let proxyAssetId = $t01645616592._5
445+ let proxyRateMul = $t01645616592._6
446+ let stakingProfitAddress = $t01645616592._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 $t02898129193 = 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 = $t02898129193._1
663+ let priceAssetBalanceDelta = $t02898129193._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 $t02963329733 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
677+ let unusedActions = $t02963329733._1
678+ let kLpNew = $t02963329733._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 $t03284633139 = 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 = $t03284633139._1
763+ let priceBalanceOld = $t03284633139._2
764+ let $t03314333292 = 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 = $t03314333292._1
768+ let priceAssetAmountRaw = $t03314333292._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 $t03342433488 = takeFee(paymentAmountRaw, inFee)
772+ let paymentAmount = $t03342433488._1
773+ let feeAmount = $t03342433488._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 $t03516935336 = 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 = $t03516935336._1
800+ let balance = $t03516935336._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 $t03741437470 = takeFee(amountRaw, outFee)
841+ let totalAmount = $t03741437470._1
842+ let feeAmount = $t03741437470._2
843+ let $t03747437700 = 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 = $t03747437700._1
847+ let outPrAmount = $t03747437700._2
848+ let amBalanceNew = $t03747437700._3
849+ let prBalanceNew = $t03747437700._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 $t03955939864 = 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 = $t03955939864._1
926+ let assetIn = $t03955939864._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 $t04435144813 = refreshKLpInternal(0, 0, 0)
1043+ if (($t04435144813 == $t04435144813))
10621044 then {
1063- let updatedKLp = $t04447644938._2
1064- let refreshKLpActions = $t04447644938._1
1045+ let updatedKLp = $t04435144813._2
1046+ let refreshKLpActions = $t04435144813._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 $t04542545490 = refreshKLpInternal(0, 0, 0)
1084+ let refreshKLpActions = $t04542545490._1
1085+ let updatedKLp = $t04542545490._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 $t04667846830 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1133+ if (($t04667846830 == $t04667846830))
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 = $t04667846830._5
1136+ let bonus = $t04667846830._4
1137+ let feeAmount = $t04667846830._3
1138+ let commonState = $t04667846830._2
1139+ let emitAmountEstimated = $t04667846830._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 $t04741647613 = 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 = $t04741647613._1
1165+ let priceAssetBalanceDelta = $t04741647613._2
1166+ let $t04761647724 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1167+ let refreshKLpActions = $t04761647724._1
1168+ let updatedKLp = $t04761647724._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 $t04807948236 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1194+ let emitAmountEstimated = $t04807948236._1
1195+ let commonState = $t04807948236._2
1196+ let feeAmount = $t04807948236._3
1197+ let bonus = $t04807948236._4
1198+ let paymentInAmountAsset = $t04807948236._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 $t04912149274 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1236+ if (($t04912149274 == $t04912149274))
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 = $t04912149274._5
1239+ let bonus = $t04912149274._4
1240+ let feeAmount = $t04912149274._3
1241+ let commonState = $t04912149274._2
1242+ let amountEstimated = $t04912149274._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 $t04993850185 = {
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 = $t04993850185._1
1265+ let priceAssetBalanceDelta = $t04993850185._2
1266+ let $t05018850296 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1267+ let refreshKLpActions = $t05018850296._1
1268+ let updatedKLp = $t05018850296._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 $t05057450730 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1288+ let amountEstimated = $t05057450730._1
1289+ let commonState = $t05057450730._2
1290+ let feeAmount = $t05057450730._3
1291+ let bonus = $t05057450730._4
1292+ let outInAmountAsset = $t05057450730._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 $t05163551786 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1330+ if (($t05163551786 == $t05163551786))
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 = $t05163551786._5
1333+ let bonus = $t05163551786._4
1334+ let feeAmount = $t05163551786._3
1335+ let commonState = $t05163551786._2
1336+ let amountEstimated = $t05163551786._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 $t05244552692 = {
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 = $t05244552692._1
1359+ let priceAssetBalanceDelta = $t05244552692._2
1360+ let $t05269552803 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1361+ let refreshKLpActions = $t05269552803._1
1362+ let updatedKLp = $t05269552803._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 $t05389853979 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1397+ let refreshKLpActions = $t05389853979._1
1398+ let updatedKLp = $t05389853979._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 $t05507455155 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1432+ let refreshKLpActions = $t05507455155._1
1433+ let updatedKLp = $t05507455155._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 $t05642756508 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1479+ let refreshKLpActions = $t05642756508._1
1480+ let updatedKLp = $t05642756508._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 $t05794958030 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1533+ let refreshKLpActions = $t05794958030._1
1534+ let updatedKLp = $t05794958030._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 $t05923459298 = refreshKLpInternal(0, 0, 0)
1570+ let kLpUpdateActions = $t05923459298._1
1571+ let updatedKLp = $t05923459298._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 $t06796068077 = if (skipOrderValidation())
17651747 then $Tuple2(true, "")
17661748 else validateMatcherOrderAllowed(order)
1767- let orderValid = $t06808568202._1
1768- let orderValidInfo = $t06808568202._2
1749+ let orderValid = $t06796068077._1
1750+ let orderValidInfo = $t06796068077._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/169f3d6 
254.42 ms