tx · HSfdGnuCToxuFZSFt8BWwPYjGpb5y5kG6uy4KZt4UeFZ

3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh:  -0.04300000 Waves

2023.04.03 15:46 [2518409] smart account 3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh > SELF 0.00000000 Waves

{ "type": 13, "id": "HSfdGnuCToxuFZSFt8BWwPYjGpb5y5kG6uy4KZt4UeFZ", "fee": 4300000, "feeAssetId": null, "timestamp": 1680525988395, "version": 2, "chainId": 84, "sender": "3N6wAa7PMFZJu4Zrmp3avXmMnRTrRpMM9Lh", "senderPublicKey": "Cr8D7eozSzJh7XHsYTjBinPpo3SS83BrCGiBAJsjGxBo", "proofs": [ "4x9yxWpo2ST9aS1etnVqSAJsNwdbRZVkCmzHbRv4rTLjXbxGiDECBdBwZmW2JtwQansu9EJ5ftBRhdoYYkgL3wdd" ], "script": "base64:BgLsNggCEgASBQoDAQQBEgcKBQEEAQgBEgMKAQgSABIECgIBBBIDCgEBEgQKAgEEEgQKAggBEgQKAggBEgQKAggBEgUKAwEIARIAEgQKAgEBEgMKAQESBQoDAQEBEgQKAggIEgASABIDCgEIEgUKAwEBARIECgIBARIECgIIARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAEgMKAQESAwoBARIECgIIASIKbFBkZWNpbWFscyIGc2NhbGU4IgxzY2FsZThCaWdJbnQiB3NjYWxlMTgiCnplcm9CaWdJbnQiBGJpZzAiBGJpZzEiBGJpZzIiC3dhdmVzU3RyaW5nIgNTRVAiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIg5pZHhQb29sQWRkcmVzcyINaWR4UG9vbFN0YXR1cyIQaWR4UG9vbExQQXNzZXRJZCINaWR4QW10QXNzZXRJZCIPaWR4UHJpY2VBc3NldElkIg5pZHhBbXRBc3NldERjbSIQaWR4UHJpY2VBc3NldERjbSIOaWR4SUF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aWkBAmlqAAQCaWsEAmJWCQECZlYAAwkAAQIFAmJWAgpCeXRlVmVjdG9yBAJmWgUCYlYFAmZaAwkAAQIFAmJWAgRVbml0CAUCaWkPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IEAmJWBQJpaQMJAAECBQJiVgIFT3JkZXIEAmV5BQJiVgQCaWwJAQJiZAAEAmltCQECZXgBBQJleQQCYUsIBQJpbQJfMQQCYUwIBQJpbQJfMgQCYU0JAPQDAwgFAmV5CWJvZHlCeXRlcwkAkQMCCAUCZXkGcHJvb2ZzAAAIBQJleQ9zZW5kZXJQdWJsaWNLZXkEAmFOCQD0AwMIBQJleQlib2R5Qnl0ZXMJAJEDAggFAmV5BnByb29mcwABBQJpbAMDAwUCYUsFAmFNBwUCYU4HBgkBAmFKBAUCYUsFAmFMBQJhTQUCYU4DCQABAgUCYlYCFFNldFNjcmlwdFRyYW5zYWN0aW9uBAJmVwUCYlYDCQD0AwMIBQJpaQlib2R5Qnl0ZXMJAJEDAggFAmlpBnByb29mcwAABQJpawYEAmluCQD2AwEJAQV2YWx1ZQEIBQJmVwZzY3JpcHQEAmlvCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYVYJAQJhSAAEAmlwCQDxBwEFBHRoaXMDCQAAAgUCaW8FAmluCQECIT0CBQJpcAUCaW4HCQD0AwMIBQJpaQlib2R5Qnl0ZXMJAJEDAggFAmlpBnByb29mcwAABQJpa8WmiLQ=", "height": 2518409, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9kcVgc9W2TN2smasocKHfHKdzLeCfb69WFd3XB4NyvVV Next: AW4YZ4n3KvY1AESN4Bn2s1bqSuz6BoA7oyMXT9XohiUK Diff:
OldNewDifferences
130130
131131 let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
132132
133+func keySWavesAssetId () = "%s__sWavesAssetId"
134+
135+
136+func keySWavesProxyAddress () = "%s__sWavesProxyAddress"
137+
138+
139+func keyAdditionalBalance (assetId) = makeString(["%s%s", "additionalBalance", assetId], SEP)
140+
141+
142+func keyStakingAssetBalance (assetId) = makeString(["%s%s", "stakingAssetBalance", assetId], SEP)
143+
144+
145+func getAdditionalBalance (assetId) = valueOrElse(getInteger(this, keyAdditionalBalance(assetId)), 0)
146+
147+
148+func getStakingAssetBalance (assetId) = valueOrElse(getInteger(this, keyStakingAssetBalance(assetId)), 0)
149+
150+
133151 func keyFactoryConfig () = "%s__factoryConfig"
134152
135153
189207 else throw(($getType(@) + " couldn't be cast to Int"))
190208 }
191209
210+func sWavesId () = getStringOrFail(factoryContract, keySWavesAssetId())
211+
212+
213+func sWavesProxy () = getStringOrFail(factoryContract, keySWavesProxyAddress())
214+
215+
192216 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
193217
194218
219243
220244 let poolConfigParsed = parsePoolConfig(getPoolConfig())
221245
222-let $t084698635 = poolConfigParsed
246+let $t092129378 = poolConfigParsed
223247
224-let cfgPoolAddress = $t084698635._1
248+let cfgPoolAddress = $t092129378._1
225249
226-let cfgPoolStatus = $t084698635._2
250+let cfgPoolStatus = $t092129378._2
227251
228-let cfgLpAssetId = $t084698635._3
252+let cfgLpAssetId = $t092129378._3
229253
230-let cfgAmountAssetId = $t084698635._4
254+let cfgAmountAssetId = $t092129378._4
231255
232-let cfgPriceAssetId = $t084698635._5
256+let cfgPriceAssetId = $t092129378._5
233257
234-let cfgAmountAssetDecimals = $t084698635._6
258+let cfgAmountAssetDecimals = $t092129378._6
235259
236-let cfgPriceAssetDecimals = $t084698635._7
260+let cfgPriceAssetDecimals = $t092129378._7
237261
238262 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
239263
249273
250274
251275 func getAccBalance (assetId) = if ((assetId == "WAVES"))
252- then wavesBalance(this).available
253- else assetBalance(this, fromBase58String(assetId))
276+ then (wavesBalance(this).available + getAdditionalBalance(assetId))
277+ else if ((assetId == sWavesId()))
278+ then {
279+ let amtAsset = getStringOrFail(this, aa())
280+ let priceAsset = getStringOrFail(this, pa())
281+ if (if (if ((amtAsset == "WAVES"))
282+ then (priceAsset == sWavesId())
283+ else false)
284+ then true
285+ else if ((priceAsset == "WAVES"))
286+ then (amtAsset == sWavesId())
287+ else false)
288+ then assetBalance(this, fromBase58String(assetId))
289+ else (assetBalance(this, fromBase58String(assetId)) + getStakingAssetBalance(assetId))
290+ }
291+ else assetBalance(this, fromBase58String(assetId))
254292
255293
256294 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
257295
258296
259297 func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
298+
299+
300+func getRate (proxy) = {
301+ let inv = invoke(proxy, "getRate", nil, nil)
302+ if ((inv == inv))
303+ then match inv {
304+ case r: Int =>
305+ r
306+ case _ =>
307+ throwErr("proxy.getRate() unexpected value")
308+ }
309+ else throw("Strict value is not equal to itself.")
310+ }
311+
312+
313+func deposit (assetId,amount,stakingAssetId,proxy) = {
314+ let currentAdditionalBalance = getAdditionalBalance(assetId)
315+ if ((currentAdditionalBalance == currentAdditionalBalance))
316+ then {
317+ let currentStakingAssetBalance = getStakingAssetBalance(stakingAssetId)
318+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
319+ then {
320+ let asset = parseAssetId(assetId)
321+ if ((amount > 0))
322+ then {
323+ let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)])
324+ if ((depositInvoke == depositInvoke))
325+ then match depositInvoke {
326+ case receivedStakingAsset: Int =>
327+ let newAdditionalBalance = (currentAdditionalBalance + amount)
328+ let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
329+[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
330+ case _ =>
331+ nil
332+ }
333+ else throw("Strict value is not equal to itself.")
334+ }
335+ else nil
336+ }
337+ else throw("Strict value is not equal to itself.")
338+ }
339+ else throw("Strict value is not equal to itself.")
340+ }
341+
342+
343+func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul) = {
344+ let currentAdditionalBalance = getAdditionalBalance(assetId)
345+ if ((currentAdditionalBalance == currentAdditionalBalance))
346+ then {
347+ let currentStakingAssetBalance = getStakingAssetBalance(stakingAssetId)
348+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
349+ then {
350+ let currentProxyRate = getRate(proxy)
351+ if ((currentProxyRate == currentProxyRate))
352+ then {
353+ let stakingAsset = parseAssetId(stakingAssetId)
354+ let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
355+ if ((sendStakingAssetAmount > 0))
356+ then {
357+ let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
358+ if ((withdrawInvoke == withdrawInvoke))
359+ then match withdrawInvoke {
360+ case receivedAssets: Int =>
361+ let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
362+ let newStakingAssetBalance = (currentStakingAssetBalance - sendStakingAssetAmount)
363+[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
364+ case _ =>
365+ nil
366+ }
367+ else throw("Strict value is not equal to itself.")
368+ }
369+ else nil
370+ }
371+ else throw("Strict value is not equal to itself.")
372+ }
373+ else throw("Strict value is not equal to itself.")
374+ }
375+ else throw("Strict value is not equal to itself.")
376+ }
377+
378+
379+func getLeaseProxyConfig (assetId) = invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil)
380+
381+
382+func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul) = {
383+ let currentAdditionalBalance = getAdditionalBalance(assetId)
384+ if ((currentAdditionalBalance == currentAdditionalBalance))
385+ then {
386+ let currentStakingAssetBalance = getStakingAssetBalance(stakingAssetId)
387+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
388+ then {
389+ let availableBalance = match parseAssetId(assetId) {
390+ case b: ByteVector =>
391+ assetBalance(this, b)
392+ case u: Unit =>
393+ wavesBalance(this).available
394+ case _ =>
395+ throw("Match error")
396+ }
397+ if ((availableBalance == availableBalance))
398+ then {
399+ let wholeBalance = max([0, ((availableBalance + currentAdditionalBalance) - minBalance)])
400+ let targetAdditionalBalance = fraction(targetRatio, wholeBalance, 100)
401+ let diff = (currentAdditionalBalance - targetAdditionalBalance)
402+ if ((diff == 0))
403+ then nil
404+ else if ((0 > diff))
405+ then {
406+ let sendAssetAmount = -(diff)
407+ deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
408+ }
409+ else {
410+ let getAssetAmount = diff
411+ withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul)
412+ }
413+ }
414+ else throw("Strict value is not equal to itself.")
415+ }
416+ else throw("Strict value is not equal to itself.")
417+ }
418+ else throw("Strict value is not equal to itself.")
419+ }
420+
421+
422+func rebalanceAsset (assetId) = match getLeaseProxyConfig(assetId) {
423+ case a: (Boolean, Int, Int, String, String, Int, String) =>
424+ let $t01551515624 = a
425+ let isLeasable = $t01551515624._1
426+ let leasedRatio = $t01551515624._2
427+ let minBalance = $t01551515624._3
428+ let proxyAddress = $t01551515624._4
429+ let proxyAssetId = $t01551515624._5
430+ let proxyRateMul = $t01551515624._6
431+ let stakingProfitAddress = $t01551515624._7
432+ if (isLeasable)
433+ then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul)
434+ else nil
435+ case _ =>
436+ throwErr((("[" + assetId) + "] Rebalance error"))
437+}
260438
261439
262440 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
438616 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
439617 let amountAssetAmount = order.amount
440618 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
441- let $t02154121753 = if ((order.orderType == Buy))
619+ let $t02714527357 = if ((order.orderType == Buy))
442620 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
443621 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
444- let amountAssetBalanceDelta = $t02154121753._1
445- let priceAssetBalanceDelta = $t02154121753._2
622+ let amountAssetBalanceDelta = $t02714527357._1
623+ let priceAssetBalanceDelta = $t02714527357._2
446624 if (if (if (isGlobalShutdown())
447625 then true
448626 else (cfgPoolStatus == PoolMatcherDisabled))
455633 then throw("Wrong order assets.")
456634 else {
457635 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
458- let $t02219322293 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
459- let unusedActions = $t02219322293._1
460- let kLpNew = $t02219322293._2
636+ let $t02779727897 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
637+ let unusedActions = $t02779727897._1
638+ let kLpNew = $t02779727897._2
461639 let isOrderValid = (kLpNew >= kLp)
462640 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
463641 $Tuple2(isOrderValid, info)
536714 else if ((paymentAssetId == cfgPriceAssetId))
537715 then false
538716 else throwErr("invalid asset")
539- let $t02540625699 = if (isEval)
717+ let $t03101031303 = if (isEval)
540718 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
541719 else if (paymentInAmountAsset)
542720 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
543721 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
544- let amountBalanceOld = $t02540625699._1
545- let priceBalanceOld = $t02540625699._2
546- let $t02570325852 = if (paymentInAmountAsset)
722+ let amountBalanceOld = $t03101031303._1
723+ let priceBalanceOld = $t03101031303._2
724+ let $t03130731456 = if (paymentInAmountAsset)
547725 then $Tuple2(paymentAmountRaw, 0)
548726 else $Tuple2(0, paymentAmountRaw)
549- let amountAssetAmountRaw = $t02570325852._1
550- let priceAssetAmountRaw = $t02570325852._2
727+ let amountAssetAmountRaw = $t03130731456._1
728+ let priceAssetAmountRaw = $t03130731456._2
551729 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
552730 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
553- let $t02598426048 = takeFee(paymentAmountRaw, inFee)
554- let paymentAmount = $t02598426048._1
555- let feeAmount = $t02598426048._2
731+ let $t03158831652 = takeFee(paymentAmountRaw, inFee)
732+ let paymentAmount = $t03158831652._1
733+ let feeAmount = $t03158831652._2
556734 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
557735 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
558736 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
575753 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
576754 let priceOld = fromX18(priceOldX18, scale8)
577755 let loss = {
578- let $t02772927896 = if (paymentInAmountAsset)
756+ let $t03333333500 = if (paymentInAmountAsset)
579757 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
580758 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
581- let amount = $t02772927896._1
582- let balance = $t02772927896._2
759+ let amount = $t03333333500._1
760+ let balance = $t03333333500._2
583761 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
584762 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
585763 }
619797 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
620798 let redeemedBigInt = toBigInt(paymentAmount)
621799 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
622- let $t02997430030 = takeFee(amountRaw, outFee)
623- let totalAmount = $t02997430030._1
624- let feeAmount = $t02997430030._2
625- let $t03003430260 = if (outInAmountAsset)
800+ let $t03557835634 = takeFee(amountRaw, outFee)
801+ let totalAmount = $t03557835634._1
802+ let feeAmount = $t03557835634._2
803+ let $t03563835864 = if (outInAmountAsset)
626804 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
627805 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
628- let outAmAmount = $t03003430260._1
629- let outPrAmount = $t03003430260._2
630- let amBalanceNew = $t03003430260._3
631- let prBalanceNew = $t03003430260._4
806+ let outAmAmount = $t03563835864._1
807+ let outPrAmount = $t03563835864._2
808+ let amBalanceNew = $t03563835864._3
809+ let prBalanceNew = $t03563835864._4
632810 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
633811 let priceNew = fromX18(priceNewX18, scale8)
634812 let commonState = if (isEval)
694872
695873
696874 @Callable(i)
875+func rebalance () = (rebalanceAsset(aa()) ++ rebalanceAsset(pa()))
876+
877+
878+
879+@Callable(i)
697880 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
698- let $t03197732282 = if ((isReverse == false))
881+ let $t03770438009 = if ((isReverse == false))
699882 then {
700883 let assetOut = getStringOrFail(this, pa())
701884 let assetIn = getStringOrFail(this, aa())
706889 let assetIn = getStringOrFail(this, pa())
707890 $Tuple2(assetOut, assetIn)
708891 }
709- let assetOut = $t03197732282._1
710- let assetIn = $t03197732282._2
892+ let assetOut = $t03770438009._1
893+ let assetIn = $t03770438009._2
711894 let poolAssetInBalance = getAccBalance(assetIn)
712895 let poolAssetOutBalance = getAccBalance(assetOut)
713896 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
757940 then true
758941 else throw("Exchange result is fewer coins than expected")
759942 if ((checkMin == checkMin))
760- then $Tuple2([ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))], amountOut)
943+ then {
944+ let lsConf = match getLeaseProxyConfig(assetOut) {
945+ case a: (Boolean, Int, Int, String, String, Int, String) =>
946+ a
947+ case _ =>
948+ throw("error lease config")
949+ }
950+ let $t04001540129 = lsConf
951+ let isLeasable = $t04001540129._1
952+ let leasedRatio = $t04001540129._2
953+ let minBalance = $t04001540129._3
954+ let proxyAddress = $t04001540129._4
955+ let proxyAssetId = $t04001540129._5
956+ let proxyRateMul = $t04001540129._6
957+ let stakingProfitAddress = $t04001540129._7
958+ let assetOnPool = assetBalance(this, fromBase58String(assetOut))
959+ let amountOfProfit = if (if ((assetOut == "WAVES"))
960+ then (amountOut > assetOnPool)
961+ else false)
962+ then {
963+ let amountDiff = (amountOut - assetOnPool)
964+ let oldRatio = (getAdditionalBalance(assetOut) / getStakingAssetBalance(sWavesId()))
965+ let oldWavesRoughBalane = wavesBalance(this).available
966+ let wd = invoke(this, "withdraw", [assetOut, amountDiff, sWavesId(), sWavesProxy(), proxyRateMul], nil)
967+ if ((wd == wd))
968+ then {
969+ let newWavesRoughBalane = wavesBalance(this).available
970+ let wavesDiff = (newWavesRoughBalane - oldWavesRoughBalane)
971+ (wavesDiff - amountDiff)
972+ }
973+ else throw("Strict value is not equal to itself.")
974+ }
975+ else 0
976+ let reb = invoke(this, "rebalance", nil, nil)
977+ if ((reb == reb))
978+ then $Tuple2([ScriptTransfer(addressFromStringValue(stakingProfitAddress), amountOfProfit, unit), ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))], amountOut)
979+ else throw("Strict value is not equal to itself.")
980+ }
761981 else throw("Strict value is not equal to itself.")
762982 }
763983 else throw("Strict value is not equal to itself.")
8481068 else throw("Strict value is not equal to itself.")
8491069 }
8501070 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
851- let $t03716637628 = refreshKLpInternal(0, 0, 0)
852- if (($t03716637628 == $t03716637628))
1071+ let $t04394044402 = refreshKLpInternal(0, 0, 0)
1072+ if (($t04394044402 == $t04394044402))
8531073 then {
854- let updatedKLp = $t03716637628._2
855- let refreshKLpActions = $t03716637628._1
1074+ let updatedKLp = $t04394044402._2
1075+ let refreshKLpActions = $t04394044402._1
8561076 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
8571077 if ((isUpdatedKLpValid == isUpdatedKLpValid))
8581078 then ((state ++ lpTransfer) ++ refreshKLpActions)
8841104 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
8851105 if ((currentKLp == currentKLp))
8861106 then {
887- let $t03819038255 = refreshKLpInternal(0, 0, 0)
888- let refreshKLpActions = $t03819038255._1
889- let updatedKLp = $t03819038255._2
1107+ let $t04496445029 = refreshKLpInternal(0, 0, 0)
1108+ let refreshKLpActions = $t04496445029._1
1109+ let updatedKLp = $t04496445029._2
8901110 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
8911111 if ((isUpdatedKLpValid == isUpdatedKLpValid))
8921112 then (state ++ refreshKLpActions)
9331153 then {
9341154 let userAddress = i.caller
9351155 let txId = i.transactionId
936- let $t03944339595 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
937- if (($t03944339595 == $t03944339595))
1156+ let $t04621746369 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1157+ if (($t04621746369 == $t04621746369))
9381158 then {
939- let paymentInAmountAsset = $t03944339595._5
940- let bonus = $t03944339595._4
941- let feeAmount = $t03944339595._3
942- let commonState = $t03944339595._2
943- let emitAmountEstimated = $t03944339595._1
1159+ let paymentInAmountAsset = $t04621746369._5
1160+ let bonus = $t04621746369._4
1161+ let feeAmount = $t04621746369._3
1162+ let commonState = $t04621746369._2
1163+ let emitAmountEstimated = $t04621746369._1
9441164 let emitAmount = if (if ((minOutAmount > 0))
9451165 then (minOutAmount > emitAmountEstimated)
9461166 else false)
9601180 let sendFee = if ((feeAmount > 0))
9611181 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
9621182 else nil
963- let $t04018140378 = if ((this == feeCollectorAddress))
1183+ let $t04695547152 = if ((this == feeCollectorAddress))
9641184 then $Tuple2(0, 0)
9651185 else if (paymentInAmountAsset)
9661186 then $Tuple2(-(feeAmount), 0)
9671187 else $Tuple2(0, -(feeAmount))
968- let amountAssetBalanceDelta = $t04018140378._1
969- let priceAssetBalanceDelta = $t04018140378._2
970- let $t04038140489 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
971- let refreshKLpActions = $t04038140489._1
972- let updatedKLp = $t04038140489._2
1188+ let amountAssetBalanceDelta = $t04695547152._1
1189+ let priceAssetBalanceDelta = $t04695547152._2
1190+ let $t04715547263 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1191+ let refreshKLpActions = $t04715547263._1
1192+ let updatedKLp = $t04715547263._2
9731193 let kLp = value(getString(keyKLp))
9741194 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
9751195 if ((isUpdatedKLpValid == isUpdatedKLpValid))
976- then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
1196+ then {
1197+ let reb = invoke(this, "rebalance", nil, nil)
1198+ if ((reb == reb))
1199+ then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
1200+ else throw("Strict value is not equal to itself.")
1201+ }
9771202 else throw("Strict value is not equal to itself.")
9781203 }
9791204 else throw("Strict value is not equal to itself.")
9891214
9901215 @Callable(i)
9911216 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
992- let $t04079540952 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
993- let emitAmountEstimated = $t04079540952._1
994- let commonState = $t04079540952._2
995- let feeAmount = $t04079540952._3
996- let bonus = $t04079540952._4
997- let paymentInAmountAsset = $t04079540952._5
1217+ let $t04761847775 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1218+ let emitAmountEstimated = $t04761847775._1
1219+ let commonState = $t04761847775._2
1220+ let feeAmount = $t04761847775._3
1221+ let bonus = $t04761847775._4
1222+ let paymentInAmountAsset = $t04761847775._5
9981223 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
9991224 }
10001225
10311256 then {
10321257 let userAddress = i.caller
10331258 let txId = i.transactionId
1034- let $t04183741990 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1035- if (($t04183741990 == $t04183741990))
1259+ let $t04866048813 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1260+ if (($t04866048813 == $t04866048813))
10361261 then {
1037- let outInAmountAsset = $t04183741990._5
1038- let bonus = $t04183741990._4
1039- let feeAmount = $t04183741990._3
1040- let commonState = $t04183741990._2
1041- let amountEstimated = $t04183741990._1
1262+ let outInAmountAsset = $t04866048813._5
1263+ let bonus = $t04866048813._4
1264+ let feeAmount = $t04866048813._3
1265+ let commonState = $t04866048813._2
1266+ let amountEstimated = $t04866048813._1
10421267 let amount = if (if ((minOutAmount > 0))
10431268 then (minOutAmount > amountEstimated)
10441269 else false)
10451270 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
10461271 else amountEstimated
1272+ let lsConf = match getLeaseProxyConfig(outAssetIdStr) {
1273+ case a: (Boolean, Int, Int, String, String, Int, String) =>
1274+ a
1275+ case _ =>
1276+ throw("error lease config")
1277+ }
1278+ let $t04919749311 = lsConf
1279+ let isLeasable = $t04919749311._1
1280+ let leasedRatio = $t04919749311._2
1281+ let minBalance = $t04919749311._3
1282+ let proxyAddress = $t04919749311._4
1283+ let proxyAssetId = $t04919749311._5
1284+ let proxyRateMul = $t04919749311._6
1285+ let stakingProfitAddress = $t04919749311._7
1286+ let assetOnPool = assetBalance(this, fromBase58String(outAssetIdStr))
1287+ let amountOfProfit = if (if ((outAssetIdStr == "WAVES"))
1288+ then (amount > assetOnPool)
1289+ else false)
1290+ then {
1291+ let amountDiff = (amount - assetOnPool)
1292+ let oldRatio = (getAdditionalBalance(outAssetIdStr) / getStakingAssetBalance(sWavesId()))
1293+ let oldWavesRoughBalane = wavesBalance(this).available
1294+ let wd = invoke(this, "withdraw", [outAssetIdStr, amountDiff, sWavesId(), sWavesProxy(), proxyRateMul], nil)
1295+ if ((wd == wd))
1296+ then {
1297+ let newWavesRoughBalane = wavesBalance(this).available
1298+ let wavesDiff = (newWavesRoughBalane - oldWavesRoughBalane)
1299+ (wavesDiff - amountDiff)
1300+ }
1301+ else throw("Strict value is not equal to itself.")
1302+ }
1303+ else 0
1304+ let profitTransfer = [ScriptTransfer(addressFromStringValue(stakingProfitAddress), amountOfProfit, unit)]
10471305 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
10481306 if ((burnInv == burnInv))
10491307 then {
10511309 let sendFee = if ((feeAmount > 0))
10521310 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
10531311 else nil
1054- let $t04249042737 = {
1312+ let $t05035050597 = {
10551313 let feeAmountForCalc = if ((this == feeCollectorAddress))
10561314 then 0
10571315 else feeAmount
10591317 then $Tuple2(-((amount + feeAmountForCalc)), 0)
10601318 else $Tuple2(0, -((amount + feeAmountForCalc)))
10611319 }
1062- let amountAssetBalanceDelta = $t04249042737._1
1063- let priceAssetBalanceDelta = $t04249042737._2
1064- let $t04274042848 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1065- let refreshKLpActions = $t04274042848._1
1066- let updatedKLp = $t04274042848._2
1320+ let amountAssetBalanceDelta = $t05035050597._1
1321+ let priceAssetBalanceDelta = $t05035050597._2
1322+ let $t05060050708 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1323+ let refreshKLpActions = $t05060050708._1
1324+ let updatedKLp = $t05060050708._2
10671325 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10681326 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1069- then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1327+ then {
1328+ let reb = invoke(this, "rebalance", nil, nil)
1329+ if ((reb == reb))
1330+ then $Tuple2(((((commonState ++ assetTransfer) ++ profitTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1331+ else throw("Strict value is not equal to itself.")
1332+ }
10701333 else throw("Strict value is not equal to itself.")
10711334 }
10721335 else throw("Strict value is not equal to itself.")
10821345
10831346 @Callable(i)
10841347 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1085- let $t04310543261 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1086- let amountEstimated = $t04310543261._1
1087- let commonState = $t04310543261._2
1088- let feeAmount = $t04310543261._3
1089- let bonus = $t04310543261._4
1090- let outInAmountAsset = $t04310543261._5
1348+ let $t05103551191 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1349+ let amountEstimated = $t05103551191._1
1350+ let commonState = $t05103551191._2
1351+ let feeAmount = $t05103551191._3
1352+ let bonus = $t05103551191._4
1353+ let outInAmountAsset = $t05103551191._5
10911354 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
10921355 }
10931356
11241387 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
11251388 if ((unstakeInv == unstakeInv))
11261389 then {
1127- let $t04416644317 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1128- if (($t04416644317 == $t04416644317))
1390+ let $t05209652247 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1391+ if (($t05209652247 == $t05209652247))
11291392 then {
1130- let outInAmountAsset = $t04416644317._5
1131- let bonus = $t04416644317._4
1132- let feeAmount = $t04416644317._3
1133- let commonState = $t04416644317._2
1134- let amountEstimated = $t04416644317._1
1393+ let outInAmountAsset = $t05209652247._5
1394+ let bonus = $t05209652247._4
1395+ let feeAmount = $t05209652247._3
1396+ let commonState = $t05209652247._2
1397+ let amountEstimated = $t05209652247._1
11351398 let amount = if (if ((minOutAmount > 0))
11361399 then (minOutAmount > amountEstimated)
11371400 else false)
11441407 let sendFee = if ((feeAmount > 0))
11451408 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
11461409 else nil
1147- let $t04481245059 = {
1410+ let $t05274252989 = {
11481411 let feeAmountForCalc = if ((this == feeCollectorAddress))
11491412 then 0
11501413 else feeAmount
11521415 then $Tuple2(-((amount + feeAmountForCalc)), 0)
11531416 else $Tuple2(0, -((amount + feeAmountForCalc)))
11541417 }
1155- let amountAssetBalanceDelta = $t04481245059._1
1156- let priceAssetBalanceDelta = $t04481245059._2
1157- let $t04506245170 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1158- let refreshKLpActions = $t04506245170._1
1159- let updatedKLp = $t04506245170._2
1418+ let amountAssetBalanceDelta = $t05274252989._1
1419+ let priceAssetBalanceDelta = $t05274252989._2
1420+ let $t05299253100 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1421+ let refreshKLpActions = $t05299253100._1
1422+ let updatedKLp = $t05299253100._2
11601423 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11611424 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11621425 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
11891452 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
11901453 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11911454 then {
1192- let $t04611646198 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1193- let refreshKLpActions = $t04611646198._1
1194- let updatedKLp = $t04611646198._2
1455+ let $t05404654128 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1456+ let refreshKLpActions = $t05404654128._1
1457+ let updatedKLp = $t05404654128._2
11951458 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11961459 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11971460 then (state ++ refreshKLpActions)
12231486 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
12241487 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
12251488 then {
1226- let $t04714747228 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1227- let refreshKLpActions = $t04714747228._1
1228- let updatedKLp = $t04714747228._2
1489+ let $t05507755158 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1490+ let refreshKLpActions = $t05507755158._1
1491+ let updatedKLp = $t05507755158._2
12291492 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12301493 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12311494 then (state ++ refreshKLpActions)
12691532 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
12701533 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
12711534 then {
1272- let $t04835448435 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1273- let refreshKLpActions = $t04835448435._1
1274- let updatedKLp = $t04835448435._2
1535+ let $t05628456365 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1536+ let refreshKLpActions = $t05628456365._1
1537+ let updatedKLp = $t05628456365._2
12751538 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12761539 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12771540 then (state ++ refreshKLpActions)
13221585 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13231586 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
13241587 then {
1325- let $t04973049811 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1326- let refreshKLpActions = $t04973049811._1
1327- let updatedKLp = $t04973049811._2
1588+ let $t05766057741 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1589+ let refreshKLpActions = $t05766057741._1
1590+ let updatedKLp = $t05766057741._2
13281591 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13291592 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13301593 then (state ++ refreshKLpActions)
13591622 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
13601623 then {
13611624 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1362- let $t05099851062 = refreshKLpInternal(0, 0, 0)
1363- let kLpUpdateActions = $t05099851062._1
1364- let updatedKLp = $t05099851062._2
1625+ let $t05892858992 = refreshKLpInternal(0, 0, 0)
1626+ let kLpUpdateActions = $t05892858992._1
1627+ let updatedKLp = $t05892858992._2
13651628 let actions = if ((kLp != updatedKLp))
13661629 then kLpUpdateActions
13671630 else throwErr("nothing to refresh")
15361799 match tx {
15371800 case order: Order =>
15381801 let matcherPub = getMatcherPubOrFail()
1539- let $t05972459793 = validateMatcherOrderAllowed(order)
1540- let orderValid = $t05972459793._1
1541- let orderValidInfo = $t05972459793._2
1802+ let $t06765467723 = validateMatcherOrderAllowed(order)
1803+ let orderValid = $t06765467723._1
1804+ let orderValidInfo = $t06765467723._2
15421805 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
15431806 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
15441807 if (if (if (orderValid)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let lPdecimals = 8
55
66 let scale8 = 100000000
77
88 let scale8BigInt = toBigInt(100000000)
99
1010 let scale18 = toBigInt(1000000000000000000)
1111
1212 let zeroBigInt = toBigInt(0)
1313
1414 let big0 = toBigInt(0)
1515
1616 let big1 = toBigInt(1)
1717
1818 let big2 = toBigInt(2)
1919
2020 let wavesString = "WAVES"
2121
2222 let SEP = "__"
2323
2424 let PoolActive = 1
2525
2626 let PoolPutDisabled = 2
2727
2828 let PoolMatcherDisabled = 3
2929
3030 let PoolShutdown = 4
3131
3232 let idxPoolAddress = 1
3333
3434 let idxPoolStatus = 2
3535
3636 let idxPoolLPAssetId = 3
3737
3838 let idxAmtAssetId = 4
3939
4040 let idxPriceAssetId = 5
4141
4242 let idxAmtAssetDcm = 6
4343
4444 let idxPriceAssetDcm = 7
4545
4646 let idxIAmtAssetId = 8
4747
4848 let idxIPriceAssetId = 9
4949
5050 let idxLPAssetDcm = 10
5151
5252 let idxPoolAmtAssetAmt = 1
5353
5454 let idxPoolPriceAssetAmt = 2
5555
5656 let idxPoolLPAssetAmt = 3
5757
5858 let idxFactoryStakingContract = 1
5959
6060 let idxFactorySlippageContract = 7
6161
6262 func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult))
6363
6464
6565 func toX18BigInt (origVal,origScaleMult) = fraction(origVal, scale18, origScaleMult)
6666
6767
6868 func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18))
6969
7070
7171 func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round))
7272
7373
7474 func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale)
7575
7676
7777 func abs (val) = if ((0 > val))
7878 then -(val)
7979 else val
8080
8181
8282 func absBigInt (val) = if ((zeroBigInt > val))
8383 then -(val)
8484 else val
8585
8686
8787 func swapContract () = "%s__swapContract"
8888
8989
9090 func fc () = "%s__factoryContract"
9191
9292
9393 func mpk () = "%s__managerPublicKey"
9494
9595
9696 func pmpk () = "%s__pendingManagerPublicKey"
9797
9898
9999 func pl () = "%s%s__price__last"
100100
101101
102102 func ph (h,timestamp) = makeString(["%s%s%d%d__price__history", toString(h), toString(timestamp)], SEP)
103103
104104
105105 func pau (userAddress,txId) = ((("%s%s%s__P__" + userAddress) + "__") + txId)
106106
107107
108108 func gau (userAddress,txId) = ((("%s%s%s__G__" + userAddress) + "__") + txId)
109109
110110
111111 func aa () = "%s__amountAsset"
112112
113113
114114 func pa () = "%s__priceAsset"
115115
116116
117117 let keyFee = "%s__fee"
118118
119119 let feeDefault = fraction(10, scale8, 10000)
120120
121121 let fee = valueOrElse(getInteger(this, keyFee), feeDefault)
122122
123123 let keyKLp = makeString(["%s", "kLp"], SEP)
124124
125125 let keyKLpRefreshedHeight = makeString(["%s", "kLpRefreshedHeight"], SEP)
126126
127127 let keyKLpRefreshDelay = makeString(["%s", "refreshKLpDelay"], SEP)
128128
129129 let kLpRefreshDelayDefault = 30
130130
131131 let kLpRefreshDelay = valueOrElse(getInteger(this, keyKLpRefreshDelay), kLpRefreshDelayDefault)
132132
133+func keySWavesAssetId () = "%s__sWavesAssetId"
134+
135+
136+func keySWavesProxyAddress () = "%s__sWavesProxyAddress"
137+
138+
139+func keyAdditionalBalance (assetId) = makeString(["%s%s", "additionalBalance", assetId], SEP)
140+
141+
142+func keyStakingAssetBalance (assetId) = makeString(["%s%s", "stakingAssetBalance", assetId], SEP)
143+
144+
145+func getAdditionalBalance (assetId) = valueOrElse(getInteger(this, keyAdditionalBalance(assetId)), 0)
146+
147+
148+func getStakingAssetBalance (assetId) = valueOrElse(getInteger(this, keyStakingAssetBalance(assetId)), 0)
149+
150+
133151 func keyFactoryConfig () = "%s__factoryConfig"
134152
135153
136154 func keyMatcherPub () = "%s%s__matcher__publicKey"
137155
138156
139157 func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset")
140158
141159
142160 func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config")
143161
144162
145163 func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr)
146164
147165
148166 func keyAllPoolsShutdown () = "%s__shutdown"
149167
150168
151169 func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress)
152170
153171
154172 func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash"
155173
156174
157175 let keyFeeCollectorAddress = "%s__feeCollectorAddress"
158176
159177 func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid)))
160178
161179
162180 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
163181
164182
165183 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
166184
167185
168186 func throwErr (msg) = throw(makeString(["lp.ride:", msg], " "))
169187
170188
171189 func fmtErr (msg) = makeString(["lp.ride:", msg], " ")
172190
173191
174192 let factoryContract = addressFromStringValue(getStringOrFail(this, fc()))
175193
176194 let feeCollectorAddress = addressFromStringValue(getStringOrFail(factoryContract, keyFeeCollectorAddress))
177195
178196 let inFee = {
179197 let @ = invoke(factoryContract, "getInFeeREADONLY", [toString(this)], nil)
180198 if ($isInstanceOf(@, "Int"))
181199 then @
182200 else throw(($getType(@) + " couldn't be cast to Int"))
183201 }
184202
185203 let outFee = {
186204 let @ = invoke(factoryContract, "getOutFeeREADONLY", [toString(this)], nil)
187205 if ($isInstanceOf(@, "Int"))
188206 then @
189207 else throw(($getType(@) + " couldn't be cast to Int"))
190208 }
191209
210+func sWavesId () = getStringOrFail(factoryContract, keySWavesAssetId())
211+
212+
213+func sWavesProxy () = getStringOrFail(factoryContract, keySWavesProxyAddress())
214+
215+
192216 func isGlobalShutdown () = valueOrElse(getBoolean(factoryContract, keyAllPoolsShutdown()), false)
193217
194218
195219 func getMatcherPubOrFail () = fromBase58String(getStringOrFail(factoryContract, keyMatcherPub()))
196220
197221
198222 func getPoolConfig () = {
199223 let amtAsset = getStringOrFail(this, aa())
200224 let priceAsset = getStringOrFail(this, pa())
201225 let iPriceAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAsset))
202226 let iAmtAsset = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAsset))
203227 split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAsset), toString(iPriceAsset))), SEP)
204228 }
205229
206230
207231 func parseAssetId (input) = if ((input == wavesString))
208232 then unit
209233 else fromBase58String(input)
210234
211235
212236 func assetIdToString (input) = if ((input == unit))
213237 then wavesString
214238 else toBase58String(value(input))
215239
216240
217241 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]))
218242
219243
220244 let poolConfigParsed = parsePoolConfig(getPoolConfig())
221245
222-let $t084698635 = poolConfigParsed
246+let $t092129378 = poolConfigParsed
223247
224-let cfgPoolAddress = $t084698635._1
248+let cfgPoolAddress = $t092129378._1
225249
226-let cfgPoolStatus = $t084698635._2
250+let cfgPoolStatus = $t092129378._2
227251
228-let cfgLpAssetId = $t084698635._3
252+let cfgLpAssetId = $t092129378._3
229253
230-let cfgAmountAssetId = $t084698635._4
254+let cfgAmountAssetId = $t092129378._4
231255
232-let cfgPriceAssetId = $t084698635._5
256+let cfgPriceAssetId = $t092129378._5
233257
234-let cfgAmountAssetDecimals = $t084698635._6
258+let cfgAmountAssetDecimals = $t092129378._6
235259
236-let cfgPriceAssetDecimals = $t084698635._7
260+let cfgPriceAssetDecimals = $t092129378._7
237261
238262 func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
239263
240264
241265 let stakingContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactoryStakingContract]), "incorrect staking address")
242266
243267 let slippageContract = valueOrErrorMessage(addressFromString(getFactoryConfig()[idxFactorySlippageContract]), "incorrect staking address")
244268
245269 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)
246270
247271
248272 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)
249273
250274
251275 func getAccBalance (assetId) = if ((assetId == "WAVES"))
252- then wavesBalance(this).available
253- else assetBalance(this, fromBase58String(assetId))
276+ then (wavesBalance(this).available + getAdditionalBalance(assetId))
277+ else if ((assetId == sWavesId()))
278+ then {
279+ let amtAsset = getStringOrFail(this, aa())
280+ let priceAsset = getStringOrFail(this, pa())
281+ if (if (if ((amtAsset == "WAVES"))
282+ then (priceAsset == sWavesId())
283+ else false)
284+ then true
285+ else if ((priceAsset == "WAVES"))
286+ then (amtAsset == sWavesId())
287+ else false)
288+ then assetBalance(this, fromBase58String(assetId))
289+ else (assetBalance(this, fromBase58String(assetId)) + getStakingAssetBalance(assetId))
290+ }
291+ else assetBalance(this, fromBase58String(assetId))
254292
255293
256294 func calcPriceBigInt (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18)
257295
258296
259297 func calcPriceBigIntRound (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round)
298+
299+
300+func getRate (proxy) = {
301+ let inv = invoke(proxy, "getRate", nil, nil)
302+ if ((inv == inv))
303+ then match inv {
304+ case r: Int =>
305+ r
306+ case _ =>
307+ throwErr("proxy.getRate() unexpected value")
308+ }
309+ else throw("Strict value is not equal to itself.")
310+ }
311+
312+
313+func deposit (assetId,amount,stakingAssetId,proxy) = {
314+ let currentAdditionalBalance = getAdditionalBalance(assetId)
315+ if ((currentAdditionalBalance == currentAdditionalBalance))
316+ then {
317+ let currentStakingAssetBalance = getStakingAssetBalance(stakingAssetId)
318+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
319+ then {
320+ let asset = parseAssetId(assetId)
321+ if ((amount > 0))
322+ then {
323+ let depositInvoke = invoke(proxy, "deposit", nil, [AttachedPayment(asset, amount)])
324+ if ((depositInvoke == depositInvoke))
325+ then match depositInvoke {
326+ case receivedStakingAsset: Int =>
327+ let newAdditionalBalance = (currentAdditionalBalance + amount)
328+ let newStakingAssetBalance = (currentStakingAssetBalance + receivedStakingAsset)
329+[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
330+ case _ =>
331+ nil
332+ }
333+ else throw("Strict value is not equal to itself.")
334+ }
335+ else nil
336+ }
337+ else throw("Strict value is not equal to itself.")
338+ }
339+ else throw("Strict value is not equal to itself.")
340+ }
341+
342+
343+func withdraw (assetId,amount,stakingAssetId,proxy,proxyRateMul) = {
344+ let currentAdditionalBalance = getAdditionalBalance(assetId)
345+ if ((currentAdditionalBalance == currentAdditionalBalance))
346+ then {
347+ let currentStakingAssetBalance = getStakingAssetBalance(stakingAssetId)
348+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
349+ then {
350+ let currentProxyRate = getRate(proxy)
351+ if ((currentProxyRate == currentProxyRate))
352+ then {
353+ let stakingAsset = parseAssetId(stakingAssetId)
354+ let sendStakingAssetAmount = fraction(proxyRateMul, amount, currentProxyRate)
355+ if ((sendStakingAssetAmount > 0))
356+ then {
357+ let withdrawInvoke = invoke(proxy, "withdraw", nil, [AttachedPayment(stakingAsset, sendStakingAssetAmount)])
358+ if ((withdrawInvoke == withdrawInvoke))
359+ then match withdrawInvoke {
360+ case receivedAssets: Int =>
361+ let newAdditionalBalance = (currentAdditionalBalance - receivedAssets)
362+ let newStakingAssetBalance = (currentStakingAssetBalance - sendStakingAssetAmount)
363+[IntegerEntry(keyAdditionalBalance(assetId), newAdditionalBalance), IntegerEntry(keyStakingAssetBalance(stakingAssetId), newStakingAssetBalance)]
364+ case _ =>
365+ nil
366+ }
367+ else throw("Strict value is not equal to itself.")
368+ }
369+ else nil
370+ }
371+ else throw("Strict value is not equal to itself.")
372+ }
373+ else throw("Strict value is not equal to itself.")
374+ }
375+ else throw("Strict value is not equal to itself.")
376+ }
377+
378+
379+func getLeaseProxyConfig (assetId) = invoke(factoryContract, "getPoolLeaseConfigREADONLY", [toString(this), assetId], nil)
380+
381+
382+func rebalanceInternal (targetRatio,assetId,stakingAssetId,minBalance,proxy,proxyRateMul) = {
383+ let currentAdditionalBalance = getAdditionalBalance(assetId)
384+ if ((currentAdditionalBalance == currentAdditionalBalance))
385+ then {
386+ let currentStakingAssetBalance = getStakingAssetBalance(stakingAssetId)
387+ if ((currentStakingAssetBalance == currentStakingAssetBalance))
388+ then {
389+ let availableBalance = match parseAssetId(assetId) {
390+ case b: ByteVector =>
391+ assetBalance(this, b)
392+ case u: Unit =>
393+ wavesBalance(this).available
394+ case _ =>
395+ throw("Match error")
396+ }
397+ if ((availableBalance == availableBalance))
398+ then {
399+ let wholeBalance = max([0, ((availableBalance + currentAdditionalBalance) - minBalance)])
400+ let targetAdditionalBalance = fraction(targetRatio, wholeBalance, 100)
401+ let diff = (currentAdditionalBalance - targetAdditionalBalance)
402+ if ((diff == 0))
403+ then nil
404+ else if ((0 > diff))
405+ then {
406+ let sendAssetAmount = -(diff)
407+ deposit(assetId, sendAssetAmount, stakingAssetId, proxy)
408+ }
409+ else {
410+ let getAssetAmount = diff
411+ withdraw(assetId, getAssetAmount, stakingAssetId, proxy, proxyRateMul)
412+ }
413+ }
414+ else throw("Strict value is not equal to itself.")
415+ }
416+ else throw("Strict value is not equal to itself.")
417+ }
418+ else throw("Strict value is not equal to itself.")
419+ }
420+
421+
422+func rebalanceAsset (assetId) = match getLeaseProxyConfig(assetId) {
423+ case a: (Boolean, Int, Int, String, String, Int, String) =>
424+ let $t01551515624 = a
425+ let isLeasable = $t01551515624._1
426+ let leasedRatio = $t01551515624._2
427+ let minBalance = $t01551515624._3
428+ let proxyAddress = $t01551515624._4
429+ let proxyAssetId = $t01551515624._5
430+ let proxyRateMul = $t01551515624._6
431+ let stakingProfitAddress = $t01551515624._7
432+ if (isLeasable)
433+ then rebalanceInternal(leasedRatio, assetId, proxyAssetId, minBalance, addressFromStringValue(proxyAddress), proxyRateMul)
434+ else nil
435+ case _ =>
436+ throwErr((("[" + assetId) + "] Rebalance error"))
437+}
260438
261439
262440 func privateCalcPrice (amAssetDcm,prAssetDcm,amAmt,prAmt) = {
263441 let amtAssetAmtX18 = toX18(amAmt, amAssetDcm)
264442 let priceAssetAmtX18 = toX18(prAmt, prAssetDcm)
265443 calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
266444 }
267445
268446
269447 func calcPrices (amAmt,prAmt,lpAmt) = {
270448 let cfg = getPoolConfig()
271449 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
272450 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
273451 let priceX18 = privateCalcPrice(amtAssetDcm, priceAssetDcm, amAmt, prAmt)
274452 let amAmtX18 = toX18(amAmt, amtAssetDcm)
275453 let prAmtX18 = toX18(prAmt, priceAssetDcm)
276454 let lpAmtX18 = toX18(lpAmt, scale8)
277455 let lpPriceInAmAssetX18 = calcPriceBigInt(amAmtX18, lpAmtX18)
278456 let lpPriceInPrAssetX18 = calcPriceBigInt(prAmtX18, lpAmtX18)
279457 [priceX18, lpPriceInAmAssetX18, lpPriceInPrAssetX18]
280458 }
281459
282460
283461 func calculatePrices (amAmt,prAmt,lpAmt) = {
284462 let prices = calcPrices(amAmt, prAmt, lpAmt)
285463 [fromX18(prices[0], scale8), fromX18(prices[1], scale8), fromX18(prices[2], scale8)]
286464 }
287465
288466
289467 func estimateGetOperation (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
290468 let cfg = getPoolConfig()
291469 let lpAssetId = cfg[idxPoolLPAssetId]
292470 let amAssetId = cfg[idxAmtAssetId]
293471 let prAssetId = cfg[idxPriceAssetId]
294472 let amAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
295473 let prAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
296474 let poolStatus = cfg[idxPoolStatus]
297475 let lpEmission = valueOrErrorMessage(assetInfo(fromBase58String(lpAssetId)), (("Asset " + lpAssetId) + " doesn't exist")).quantity
298476 if ((lpAssetId != pmtAssetId))
299477 then throw("Invalid asset passed.")
300478 else {
301479 let amBalance = getAccBalance(amAssetId)
302480 let amBalanceX18 = toX18(amBalance, amAssetDcm)
303481 let prBalance = getAccBalance(prAssetId)
304482 let prBalanceX18 = toX18(prBalance, prAssetDcm)
305483 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
306484 let curPrice = fromX18(curPriceX18, scale8)
307485 let pmtLpAmtX18 = toX18(pmtLpAmt, scale8)
308486 let lpEmissionX18 = toX18(lpEmission, scale8)
309487 let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissionX18)
310488 let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissionX18)
311489 let outAmAmt = fromX18Round(outAmAmtX18, amAssetDcm, FLOOR)
312490 let outPrAmt = fromX18Round(outPrAmtX18, prAssetDcm, FLOOR)
313491 let state = if ((txId58 == ""))
314492 then nil
315493 else [ScriptTransfer(userAddress, outAmAmt, if ((amAssetId == "WAVES"))
316494 then unit
317495 else fromBase58String(amAssetId)), ScriptTransfer(userAddress, outPrAmt, if ((prAssetId == "WAVES"))
318496 then unit
319497 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)]
320498 $Tuple10(outAmAmt, outPrAmt, amAssetId, prAssetId, amBalance, prBalance, lpEmission, curPriceX18, poolStatus, state)
321499 }
322500 }
323501
324502
325503 func estimatePutOperation (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = {
326504 let cfg = getPoolConfig()
327505 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
328506 let amAssetIdStr = cfg[idxAmtAssetId]
329507 let prAssetIdStr = cfg[idxPriceAssetId]
330508 let iAmtAssetId = cfg[idxIAmtAssetId]
331509 let iPriceAssetId = cfg[idxIPriceAssetId]
332510 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
333511 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
334512 let poolStatus = cfg[idxPoolStatus]
335513 let lpEmission = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
336514 let inAmAssetIdStr = toBase58String(valueOrElse(inAmAssetId, fromBase58String("WAVES")))
337515 let inPrAssetIdStr = toBase58String(valueOrElse(inPrAssetId, fromBase58String("WAVES")))
338516 if (if ((amAssetIdStr != inAmAssetIdStr))
339517 then true
340518 else (prAssetIdStr != inPrAssetIdStr))
341519 then throw("Invalid amt or price asset passed.")
342520 else {
343521 let amBalance = if (isEvaluate)
344522 then getAccBalance(amAssetIdStr)
345523 else (getAccBalance(amAssetIdStr) - inAmAssetAmt)
346524 let prBalance = if (isEvaluate)
347525 then getAccBalance(prAssetIdStr)
348526 else (getAccBalance(prAssetIdStr) - inPrAssetAmt)
349527 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
350528 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
351529 let userPriceX18 = calcPriceBigInt(inPrAssetAmtX18, inAmAssetAmtX18)
352530 let amBalanceX18 = toX18(amBalance, amtAssetDcm)
353531 let prBalanceX18 = toX18(prBalance, priceAssetDcm)
354532 let res = if ((lpEmission == 0))
355533 then {
356534 let curPriceX18 = zeroBigInt
357535 let slippageX18 = zeroBigInt
358536 let lpAmtX18 = pow((inAmAssetAmtX18 * inPrAssetAmtX18), 0, toBigInt(5), 1, 0, DOWN)
359537 $Tuple5(fromX18(lpAmtX18, scale8), fromX18(inAmAssetAmtX18, amtAssetDcm), fromX18(inPrAssetAmtX18, priceAssetDcm), calcPriceBigInt((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18)
360538 }
361539 else {
362540 let curPriceX18 = calcPriceBigInt(prBalanceX18, amBalanceX18)
363541 let slippageX18 = fraction(absBigInt((curPriceX18 - userPriceX18)), scale18, curPriceX18)
364542 let slippageToleranceX18 = toX18(slippageTolerance, scale8)
365543 if (if ((curPriceX18 != zeroBigInt))
366544 then (slippageX18 > slippageToleranceX18)
367545 else false)
368546 then throw(((("Price slippage " + toString(slippageX18)) + " exceeded the passed limit of ") + toString(slippageToleranceX18)))
369547 else {
370548 let lpEmissionX18 = toX18(lpEmission, scale8)
371549 let prViaAmX18 = fraction(inAmAssetAmtX18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING)
372550 let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, calcPriceBigIntRound(prBalanceX18, amBalanceX18, FLOOR), CEILING)
373551 let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18))
374552 then $Tuple2(amViaPrX18, inPrAssetAmtX18)
375553 else $Tuple2(inAmAssetAmtX18, prViaAmX18)
376554 let expAmtAssetAmtX18 = expectedAmts._1
377555 let expPriceAssetAmtX18 = expectedAmts._2
378556 let lpAmtX18 = fraction(lpEmissionX18, expPriceAssetAmtX18, prBalanceX18, FLOOR)
379557 $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtAssetDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceAssetDcm, CEILING), curPriceX18, slippageX18)
380558 }
381559 }
382560 let calcLpAmt = res._1
383561 let calcAmAssetPmt = res._2
384562 let calcPrAssetPmt = res._3
385563 let curPrice = fromX18(res._4, scale8)
386564 let slippageCalc = fromX18(res._5, scale8)
387565 if ((0 >= calcLpAmt))
388566 then throw("Invalid calculations. LP calculated is less than zero.")
389567 else {
390568 let emitLpAmt = if (!(emitLp))
391569 then 0
392570 else calcLpAmt
393571 let amDiff = (inAmAssetAmt - calcAmAssetPmt)
394572 let prDiff = (inPrAssetAmt - calcPrAssetPmt)
395573 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))]
396574 $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEmission, lpAssetId, poolStatus, commonState, amDiff, prDiff, inAmAssetId, inPrAssetId)
397575 }
398576 }
399577 }
400578
401579
402580 func calcKLp (amountBalance,priceBalance,lpEmission) = {
403581 let amountBalanceX18 = toX18BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals))
404582 let priceBalanceX18 = toX18BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))
405583 let updatedKLp = fraction(pow((amountBalanceX18 * priceBalanceX18), 0, toBigInt(5), 1, 18, DOWN), big1, lpEmission)
406584 if ((lpEmission == big0))
407585 then big0
408586 else updatedKLp
409587 }
410588
411589
412590 func calcCurrentKLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = {
413591 let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta)
414592 let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta)
415593 let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta)
416594 let currentKLp = calcKLp(amountAssetBalance, priceAssetBalance, lpAssetEmission)
417595 currentKLp
418596 }
419597
420598
421599 func refreshKLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = {
422600 let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta)
423601 let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta)
424602 let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta)
425603 let updatedKLp = calcKLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission))
426604 let actions = [IntegerEntry(keyKLpRefreshedHeight, height), StringEntry(keyKLp, toString(updatedKLp))]
427605 $Tuple2(actions, updatedKLp)
428606 }
429607
430608
431609 func validateUpdatedKLp (oldKLp,updatedKLp) = if ((updatedKLp >= oldKLp))
432610 then true
433611 else throwErr(makeString(["updated KLp lower than current KLp", toString(oldKLp), toString(updatedKLp)], " "))
434612
435613
436614 func validateMatcherOrderAllowed (order) = {
437615 let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId))
438616 let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId))
439617 let amountAssetAmount = order.amount
440618 let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR)
441- let $t02154121753 = if ((order.orderType == Buy))
619+ let $t02714527357 = if ((order.orderType == Buy))
442620 then $Tuple2(amountAssetAmount, -(priceAssetAmount))
443621 else $Tuple2(-(amountAssetAmount), priceAssetAmount)
444- let amountAssetBalanceDelta = $t02154121753._1
445- let priceAssetBalanceDelta = $t02154121753._2
622+ let amountAssetBalanceDelta = $t02714527357._1
623+ let priceAssetBalanceDelta = $t02714527357._2
446624 if (if (if (isGlobalShutdown())
447625 then true
448626 else (cfgPoolStatus == PoolMatcherDisabled))
449627 then true
450628 else (cfgPoolStatus == PoolShutdown))
451629 then throw("Exchange operations disabled")
452630 else if (if ((order.assetPair.amountAsset != cfgAmountAssetId))
453631 then true
454632 else (order.assetPair.priceAsset != cfgPriceAssetId))
455633 then throw("Wrong order assets.")
456634 else {
457635 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
458- let $t02219322293 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
459- let unusedActions = $t02219322293._1
460- let kLpNew = $t02219322293._2
636+ let $t02779727897 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
637+ let unusedActions = $t02779727897._1
638+ let kLpNew = $t02779727897._2
461639 let isOrderValid = (kLpNew >= kLp)
462640 let info = makeString(["kLp=", toString(kLp), " kLpNew=", toString(kLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "")
463641 $Tuple2(isOrderValid, info)
464642 }
465643 }
466644
467645
468646 func commonGet (i) = if ((size(i.payments) != 1))
469647 then throw("exactly 1 payment is expected")
470648 else {
471649 let pmt = value(i.payments[0])
472650 let pmtAssetId = value(pmt.assetId)
473651 let pmtAmt = pmt.amount
474652 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller)
475653 let outAmAmt = res._1
476654 let outPrAmt = res._2
477655 let poolStatus = parseIntValue(res._9)
478656 let state = res._10
479657 if (if (isGlobalShutdown())
480658 then true
481659 else (poolStatus == PoolShutdown))
482660 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
483661 else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state)
484662 }
485663
486664
487665 func commonPut (i,slippageTolerance,emitLp) = if ((size(i.payments) != 2))
488666 then throw("exactly 2 payments are expected")
489667 else {
490668 let amAssetPmt = value(i.payments[0])
491669 let prAssetPmt = value(i.payments[1])
492670 let estPut = estimatePutOperation(toBase58String(i.transactionId), slippageTolerance, amAssetPmt.amount, amAssetPmt.assetId, prAssetPmt.amount, prAssetPmt.assetId, toString(i.caller), false, emitLp)
493671 let poolStatus = parseIntValue(estPut._8)
494672 if (if (if (isGlobalShutdown())
495673 then true
496674 else (poolStatus == PoolPutDisabled))
497675 then true
498676 else (poolStatus == PoolShutdown))
499677 then throw(("Put operation is blocked by admin. Status = " + toString(poolStatus)))
500678 else estPut
501679 }
502680
503681
504682 func emit (amount) = {
505683 let emitInv = invoke(factoryContract, "emit", [amount], nil)
506684 if ((emitInv == emitInv))
507685 then {
508686 let emitInvLegacy = match emitInv {
509687 case legacyFactoryContract: Address =>
510688 invoke(legacyFactoryContract, "emit", [amount], nil)
511689 case _ =>
512690 unit
513691 }
514692 if ((emitInvLegacy == emitInvLegacy))
515693 then amount
516694 else throw("Strict value is not equal to itself.")
517695 }
518696 else throw("Strict value is not equal to itself.")
519697 }
520698
521699
522700 func takeFee (amount,fee) = {
523701 let feeAmount = if ((fee == 0))
524702 then 0
525703 else fraction(amount, fee, scale8)
526704 $Tuple2((amount - feeAmount), feeAmount)
527705 }
528706
529707
530708 func calcPutOneToken (paymentAmountRaw,paymentAssetId,userAddress,txId) = {
531709 let isEval = (txId == unit)
532710 let amountBalanceRaw = getAccBalance(assetIdToString(cfgAmountAssetId))
533711 let priceBalanceRaw = getAccBalance(assetIdToString(cfgPriceAssetId))
534712 let paymentInAmountAsset = if ((paymentAssetId == cfgAmountAssetId))
535713 then true
536714 else if ((paymentAssetId == cfgPriceAssetId))
537715 then false
538716 else throwErr("invalid asset")
539- let $t02540625699 = if (isEval)
717+ let $t03101031303 = if (isEval)
540718 then $Tuple2(amountBalanceRaw, priceBalanceRaw)
541719 else if (paymentInAmountAsset)
542720 then $Tuple2((amountBalanceRaw - paymentAmountRaw), priceBalanceRaw)
543721 else $Tuple2(amountBalanceRaw, (priceBalanceRaw - paymentAmountRaw))
544- let amountBalanceOld = $t02540625699._1
545- let priceBalanceOld = $t02540625699._2
546- let $t02570325852 = if (paymentInAmountAsset)
722+ let amountBalanceOld = $t03101031303._1
723+ let priceBalanceOld = $t03101031303._2
724+ let $t03130731456 = if (paymentInAmountAsset)
547725 then $Tuple2(paymentAmountRaw, 0)
548726 else $Tuple2(0, paymentAmountRaw)
549- let amountAssetAmountRaw = $t02570325852._1
550- let priceAssetAmountRaw = $t02570325852._2
727+ let amountAssetAmountRaw = $t03130731456._1
728+ let priceAssetAmountRaw = $t03130731456._2
551729 let amountAssetAmount = takeFee(amountAssetAmountRaw, inFee)._1
552730 let priceAssetAmount = takeFee(priceAssetAmountRaw, inFee)._1
553- let $t02598426048 = takeFee(paymentAmountRaw, inFee)
554- let paymentAmount = $t02598426048._1
555- let feeAmount = $t02598426048._2
731+ let $t03158831652 = takeFee(paymentAmountRaw, inFee)
732+ let paymentAmount = $t03158831652._1
733+ let feeAmount = $t03158831652._2
556734 let amountBalanceNew = (amountBalanceOld + amountAssetAmount)
557735 let priceBalanceNew = (priceBalanceOld + priceAssetAmount)
558736 let priceNewX18 = calcPriceBigInt(toX18(priceBalanceNew, cfgPriceAssetDecimals), toX18(amountBalanceNew, cfgAmountAssetDecimals))
559737 let priceNew = fromX18(priceNewX18, scale8)
560738 let paymentBalance = if (paymentInAmountAsset)
561739 then amountBalanceOld
562740 else priceBalanceOld
563741 let paymentBalanceBigInt = toBigInt(paymentBalance)
564742 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
565743 let chechSupply = if ((supplyBigInt > big0))
566744 then true
567745 else throwErr("initial deposit requires all coins")
568746 if ((chechSupply == chechSupply))
569747 then {
570748 let depositBigInt = toBigInt(paymentAmount)
571749 let issueAmount = max([0, toInt(((supplyBigInt * (sqrtBigInt((scale18 + ((depositBigInt * scale18) / paymentBalanceBigInt)), 18, 18, DOWN) - scale18)) / scale18))])
572750 let commonState = if (isEval)
573751 then nil
574752 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))]
575753 let priceOldX18 = calcPriceBigInt(toX18(priceBalanceOld, cfgPriceAssetDecimals), toX18(amountBalanceOld, cfgAmountAssetDecimals))
576754 let priceOld = fromX18(priceOldX18, scale8)
577755 let loss = {
578- let $t02772927896 = if (paymentInAmountAsset)
756+ let $t03333333500 = if (paymentInAmountAsset)
579757 then $Tuple2(amountAssetAmountRaw, amountBalanceOld)
580758 else $Tuple2(priceAssetAmountRaw, priceBalanceOld)
581- let amount = $t02772927896._1
582- let balance = $t02772927896._2
759+ let amount = $t03333333500._1
760+ let balance = $t03333333500._2
583761 let issueAmountBoth = toInt(fraction(supplyBigInt, toBigInt((amount / 2)), toBigInt(balance)))
584762 fraction((issueAmount - issueAmountBoth), scale8, issueAmountBoth)
585763 }
586764 $Tuple5(issueAmount, commonState, feeAmount, loss, paymentInAmountAsset)
587765 }
588766 else throw("Strict value is not equal to itself.")
589767 }
590768
591769
592770 func calcGetOneToken (outAssetId,paymentAmount,paymentAssetId,userAddress,txId) = {
593771 let isEval = (txId == unit)
594772 let cfg = getPoolConfig()
595773 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
596774 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
597775 let checks = [if ((paymentAssetId == cfgLpAssetId))
598776 then true
599777 else throwErr("invalid lp asset")]
600778 if ((checks == checks))
601779 then {
602780 let outInAmountAsset = if ((outAssetId == cfgAmountAssetId))
603781 then true
604782 else if ((outAssetId == cfgPriceAssetId))
605783 then false
606784 else throwErr("invalid asset")
607785 let balanceBigInt = if (outInAmountAsset)
608786 then toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId)))
609787 else toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId)))
610788 let outInAmountAssetDecimals = if (outInAmountAsset)
611789 then amtAssetDcm
612790 else priceAssetDcm
613791 let amBalanceOld = getAccBalance(assetIdToString(cfgAmountAssetId))
614792 let prBalanceOld = getAccBalance(assetIdToString(cfgPriceAssetId))
615793 let outBalance = if (outInAmountAsset)
616794 then amBalanceOld
617795 else prBalanceOld
618796 let outBalanceBigInt = toBigInt(outBalance)
619797 let supplyBigInt = toBigInt(valueOrErrorMessage(assetInfo(cfgLpAssetId), (("asset " + toBase58String(cfgLpAssetId)) + " doesn't exist")).quantity)
620798 let redeemedBigInt = toBigInt(paymentAmount)
621799 let amountRaw = max([0, toInt(((balanceBigInt * (scale18 - pow((scale18 - ((redeemedBigInt * scale18) / supplyBigInt)), 18, big2, 0, 18, DOWN))) / scale18))])
622- let $t02997430030 = takeFee(amountRaw, outFee)
623- let totalAmount = $t02997430030._1
624- let feeAmount = $t02997430030._2
625- let $t03003430260 = if (outInAmountAsset)
800+ let $t03557835634 = takeFee(amountRaw, outFee)
801+ let totalAmount = $t03557835634._1
802+ let feeAmount = $t03557835634._2
803+ let $t03563835864 = if (outInAmountAsset)
626804 then $Tuple4(totalAmount, 0, (amBalanceOld - amountRaw), prBalanceOld)
627805 else $Tuple4(0, totalAmount, amBalanceOld, (prBalanceOld - amountRaw))
628- let outAmAmount = $t03003430260._1
629- let outPrAmount = $t03003430260._2
630- let amBalanceNew = $t03003430260._3
631- let prBalanceNew = $t03003430260._4
806+ let outAmAmount = $t03563835864._1
807+ let outPrAmount = $t03563835864._2
808+ let amBalanceNew = $t03563835864._3
809+ let prBalanceNew = $t03563835864._4
632810 let priceNewX18 = calcPriceBigInt(toX18(prBalanceNew, cfgPriceAssetDecimals), toX18(amBalanceNew, cfgAmountAssetDecimals))
633811 let priceNew = fromX18(priceNewX18, scale8)
634812 let commonState = if (isEval)
635813 then nil
636814 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)]
637815 let priceOldX18 = calcPriceBigInt(toX18(prBalanceOld, cfgPriceAssetDecimals), toX18(amBalanceOld, cfgAmountAssetDecimals))
638816 let priceOld = fromX18(priceOldX18, scale8)
639817 let loss = {
640818 let amountBothInPaymentAsset = (toInt(fraction(balanceBigInt, redeemedBigInt, supplyBigInt)) * 2)
641819 fraction((totalAmount - amountBothInPaymentAsset), scale8, amountBothInPaymentAsset)
642820 }
643821 $Tuple5(totalAmount, commonState, feeAmount, loss, outInAmountAsset)
644822 }
645823 else throw("Strict value is not equal to itself.")
646824 }
647825
648826
649827 func managerPublicKeyOrUnit () = match getString(mpk()) {
650828 case s: String =>
651829 fromBase58String(s)
652830 case _: Unit =>
653831 unit
654832 case _ =>
655833 throw("Match error")
656834 }
657835
658836
659837 func pendingManagerPublicKeyOrUnit () = match getString(pmpk()) {
660838 case s: String =>
661839 fromBase58String(s)
662840 case _: Unit =>
663841 unit
664842 case _ =>
665843 throw("Match error")
666844 }
667845
668846
669847 func isManager (i) = match managerPublicKeyOrUnit() {
670848 case pk: ByteVector =>
671849 (i.callerPublicKey == pk)
672850 case _: Unit =>
673851 (i.caller == this)
674852 case _ =>
675853 throw("Match error")
676854 }
677855
678856
679857 func mustManager (i) = {
680858 let pd = throw("Permission denied")
681859 match managerPublicKeyOrUnit() {
682860 case pk: ByteVector =>
683861 if ((i.callerPublicKey == pk))
684862 then true
685863 else pd
686864 case _: Unit =>
687865 if ((i.caller == this))
688866 then true
689867 else pd
690868 case _ =>
691869 throw("Match error")
692870 }
693871 }
694872
695873
696874 @Callable(i)
875+func rebalance () = (rebalanceAsset(aa()) ++ rebalanceAsset(pa()))
876+
877+
878+
879+@Callable(i)
697880 func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = {
698- let $t03197732282 = if ((isReverse == false))
881+ let $t03770438009 = if ((isReverse == false))
699882 then {
700883 let assetOut = getStringOrFail(this, pa())
701884 let assetIn = getStringOrFail(this, aa())
702885 $Tuple2(assetOut, assetIn)
703886 }
704887 else {
705888 let assetOut = getStringOrFail(this, aa())
706889 let assetIn = getStringOrFail(this, pa())
707890 $Tuple2(assetOut, assetIn)
708891 }
709- let assetOut = $t03197732282._1
710- let assetIn = $t03197732282._2
892+ let assetOut = $t03770438009._1
893+ let assetIn = $t03770438009._2
711894 let poolAssetInBalance = getAccBalance(assetIn)
712895 let poolAssetOutBalance = getAccBalance(assetOut)
713896 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
714897 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
715898 let newK = (((toBigInt(getAccBalance(assetIn)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
716899 let checkK = if ((newK >= oldK))
717900 then true
718901 else throw("new K is fewer error")
719902 if ((checkK == checkK))
720903 then $Tuple2(nil, amountOut)
721904 else throw("Strict value is not equal to itself.")
722905 }
723906
724907
725908
726909 @Callable(i)
727910 func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = {
728911 let swapContact = {
729912 let @ = invoke(factoryContract, "getSwapContractREADONLY", nil, nil)
730913 if ($isInstanceOf(@, "String"))
731914 then @
732915 else throw(($getType(@) + " couldn't be cast to String"))
733916 }
734917 let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn))
735918 then true
736919 else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact)))
737920 then true
738921 else throwErr("Permission denied")]
739922 if ((checks == checks))
740923 then {
741924 let pmt = value(i.payments[0])
742925 let assetIn = assetIdToString(pmt.assetId)
743926 let assetOut = if ((isReverse == false))
744927 then getStringOrFail(this, pa())
745928 else getStringOrFail(this, aa())
746929 let poolAssetInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount)
747930 let poolAssetOutBalance = getAccBalance(assetOut)
748931 let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, (poolAssetInBalance + cleanAmountIn))
749932 let oldK = (toBigInt(poolAssetInBalance) * toBigInt(poolAssetOutBalance))
750933 let newK = ((toBigInt(getAccBalance(assetIn)) + toBigInt(feePoolAmount)) * (toBigInt(getAccBalance(assetOut)) - toBigInt(amountOut)))
751934 let checkK = if ((newK >= oldK))
752935 then true
753936 else throw("new K is fewer error")
754937 if ((checkK == checkK))
755938 then {
756939 let checkMin = if ((amountOut >= amountOutMin))
757940 then true
758941 else throw("Exchange result is fewer coins than expected")
759942 if ((checkMin == checkMin))
760- then $Tuple2([ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))], amountOut)
943+ then {
944+ let lsConf = match getLeaseProxyConfig(assetOut) {
945+ case a: (Boolean, Int, Int, String, String, Int, String) =>
946+ a
947+ case _ =>
948+ throw("error lease config")
949+ }
950+ let $t04001540129 = lsConf
951+ let isLeasable = $t04001540129._1
952+ let leasedRatio = $t04001540129._2
953+ let minBalance = $t04001540129._3
954+ let proxyAddress = $t04001540129._4
955+ let proxyAssetId = $t04001540129._5
956+ let proxyRateMul = $t04001540129._6
957+ let stakingProfitAddress = $t04001540129._7
958+ let assetOnPool = assetBalance(this, fromBase58String(assetOut))
959+ let amountOfProfit = if (if ((assetOut == "WAVES"))
960+ then (amountOut > assetOnPool)
961+ else false)
962+ then {
963+ let amountDiff = (amountOut - assetOnPool)
964+ let oldRatio = (getAdditionalBalance(assetOut) / getStakingAssetBalance(sWavesId()))
965+ let oldWavesRoughBalane = wavesBalance(this).available
966+ let wd = invoke(this, "withdraw", [assetOut, amountDiff, sWavesId(), sWavesProxy(), proxyRateMul], nil)
967+ if ((wd == wd))
968+ then {
969+ let newWavesRoughBalane = wavesBalance(this).available
970+ let wavesDiff = (newWavesRoughBalane - oldWavesRoughBalane)
971+ (wavesDiff - amountDiff)
972+ }
973+ else throw("Strict value is not equal to itself.")
974+ }
975+ else 0
976+ let reb = invoke(this, "rebalance", nil, nil)
977+ if ((reb == reb))
978+ then $Tuple2([ScriptTransfer(addressFromStringValue(stakingProfitAddress), amountOfProfit, unit), ScriptTransfer(addressFromStringValue(addressTo), amountOut, parseAssetId(assetOut))], amountOut)
979+ else throw("Strict value is not equal to itself.")
980+ }
761981 else throw("Strict value is not equal to itself.")
762982 }
763983 else throw("Strict value is not equal to itself.")
764984 }
765985 else throw("Strict value is not equal to itself.")
766986 }
767987
768988
769989
770990 @Callable(i)
771991 func setManager (pendingManagerPublicKey) = {
772992 let checkCaller = mustManager(i)
773993 if ((checkCaller == checkCaller))
774994 then {
775995 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
776996 if ((checkManagerPublicKey == checkManagerPublicKey))
777997 then [StringEntry(pmpk(), pendingManagerPublicKey)]
778998 else throw("Strict value is not equal to itself.")
779999 }
7801000 else throw("Strict value is not equal to itself.")
7811001 }
7821002
7831003
7841004
7851005 @Callable(i)
7861006 func confirmManager () = {
7871007 let pm = pendingManagerPublicKeyOrUnit()
7881008 let hasPM = if (isDefined(pm))
7891009 then true
7901010 else throw("No pending manager")
7911011 if ((hasPM == hasPM))
7921012 then {
7931013 let checkPM = if ((i.callerPublicKey == value(pm)))
7941014 then true
7951015 else throw("You are not pending manager")
7961016 if ((checkPM == checkPM))
7971017 then [StringEntry(mpk(), toBase58String(value(pm))), DeleteEntry(pmpk())]
7981018 else throw("Strict value is not equal to itself.")
7991019 }
8001020 else throw("Strict value is not equal to itself.")
8011021 }
8021022
8031023
8041024
8051025 @Callable(i)
8061026 func put (slippageTolerance,shouldAutoStake) = if ((0 > slippageTolerance))
8071027 then throw("Invalid slippageTolerance passed")
8081028 else {
8091029 let estPut = commonPut(i, slippageTolerance, true)
8101030 let emitLpAmt = estPut._2
8111031 let lpAssetId = estPut._7
8121032 let state = estPut._9
8131033 let amDiff = estPut._10
8141034 let prDiff = estPut._11
8151035 let amId = estPut._12
8161036 let prId = estPut._13
8171037 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
8181038 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
8191039 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
8201040 if ((currentKLp == currentKLp))
8211041 then {
8221042 let emitInv = invoke(factoryContract, "emit", [emitLpAmt], nil)
8231043 if ((emitInv == emitInv))
8241044 then {
8251045 let emitInvLegacy = match emitInv {
8261046 case legacyFactoryContract: Address =>
8271047 invoke(legacyFactoryContract, "emit", [emitLpAmt], nil)
8281048 case _ =>
8291049 unit
8301050 }
8311051 if ((emitInvLegacy == emitInvLegacy))
8321052 then {
8331053 let slippageAInv = if ((amDiff > 0))
8341054 then invoke(slippageContract, "put", nil, [AttachedPayment(amId, amDiff)])
8351055 else nil
8361056 if ((slippageAInv == slippageAInv))
8371057 then {
8381058 let slippagePInv = if ((prDiff > 0))
8391059 then invoke(slippageContract, "put", nil, [AttachedPayment(prId, prDiff)])
8401060 else nil
8411061 if ((slippagePInv == slippagePInv))
8421062 then {
8431063 let lpTransfer = if (shouldAutoStake)
8441064 then {
8451065 let slpStakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)])
8461066 if ((slpStakeInv == slpStakeInv))
8471067 then nil
8481068 else throw("Strict value is not equal to itself.")
8491069 }
8501070 else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)]
851- let $t03716637628 = refreshKLpInternal(0, 0, 0)
852- if (($t03716637628 == $t03716637628))
1071+ let $t04394044402 = refreshKLpInternal(0, 0, 0)
1072+ if (($t04394044402 == $t04394044402))
8531073 then {
854- let updatedKLp = $t03716637628._2
855- let refreshKLpActions = $t03716637628._1
1074+ let updatedKLp = $t04394044402._2
1075+ let refreshKLpActions = $t04394044402._1
8561076 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
8571077 if ((isUpdatedKLpValid == isUpdatedKLpValid))
8581078 then ((state ++ lpTransfer) ++ refreshKLpActions)
8591079 else throw("Strict value is not equal to itself.")
8601080 }
8611081 else throw("Strict value is not equal to itself.")
8621082 }
8631083 else throw("Strict value is not equal to itself.")
8641084 }
8651085 else throw("Strict value is not equal to itself.")
8661086 }
8671087 else throw("Strict value is not equal to itself.")
8681088 }
8691089 else throw("Strict value is not equal to itself.")
8701090 }
8711091 else throw("Strict value is not equal to itself.")
8721092 }
8731093
8741094
8751095
8761096 @Callable(i)
8771097 func putForFree (maxSlippage) = if ((0 > maxSlippage))
8781098 then throw("Invalid value passed")
8791099 else {
8801100 let estPut = commonPut(i, maxSlippage, false)
8811101 let state = estPut._9
8821102 let amAssetPmt = toBigInt(value(i.payments[0]).amount)
8831103 let prAssetPmt = toBigInt(value(i.payments[1]).amount)
8841104 let currentKLp = calcCurrentKLp(amAssetPmt, prAssetPmt, toBigInt(0))
8851105 if ((currentKLp == currentKLp))
8861106 then {
887- let $t03819038255 = refreshKLpInternal(0, 0, 0)
888- let refreshKLpActions = $t03819038255._1
889- let updatedKLp = $t03819038255._2
1107+ let $t04496445029 = refreshKLpInternal(0, 0, 0)
1108+ let refreshKLpActions = $t04496445029._1
1109+ let updatedKLp = $t04496445029._2
8901110 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
8911111 if ((isUpdatedKLpValid == isUpdatedKLpValid))
8921112 then (state ++ refreshKLpActions)
8931113 else throw("Strict value is not equal to itself.")
8941114 }
8951115 else throw("Strict value is not equal to itself.")
8961116 }
8971117
8981118
8991119
9001120 @Callable(i)
9011121 func putOneTkn (minOutAmount,autoStake) = {
9021122 let isPoolOneTokenOperationsDisabled = {
9031123 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
9041124 if ($isInstanceOf(@, "Boolean"))
9051125 then @
9061126 else throw(($getType(@) + " couldn't be cast to Boolean"))
9071127 }
9081128 let isPutDisabled = if (if (if (isGlobalShutdown())
9091129 then true
9101130 else (cfgPoolStatus == PoolPutDisabled))
9111131 then true
9121132 else (cfgPoolStatus == PoolShutdown))
9131133 then true
9141134 else isPoolOneTokenOperationsDisabled
9151135 let checks = [if (if (!(isPutDisabled))
9161136 then true
9171137 else isManager(i))
9181138 then true
9191139 else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1))
9201140 then true
9211141 else throwErr("exactly 1 payment are expected")]
9221142 if ((checks == checks))
9231143 then {
9241144 let payment = i.payments[0]
9251145 let paymentAssetId = payment.assetId
9261146 let paymentAmountRaw = payment.amount
9271147 let currentKLp = if ((paymentAssetId == cfgAmountAssetId))
9281148 then calcCurrentKLp(toBigInt(paymentAmountRaw), toBigInt(0), toBigInt(0))
9291149 else if ((paymentAssetId == cfgPriceAssetId))
9301150 then calcCurrentKLp(toBigInt(0), toBigInt(paymentAmountRaw), toBigInt(0))
9311151 else throwErr("payment asset is not supported")
9321152 if ((currentKLp == currentKLp))
9331153 then {
9341154 let userAddress = i.caller
9351155 let txId = i.transactionId
936- let $t03944339595 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
937- if (($t03944339595 == $t03944339595))
1156+ let $t04621746369 = calcPutOneToken(paymentAmountRaw, paymentAssetId, userAddress, txId)
1157+ if (($t04621746369 == $t04621746369))
9381158 then {
939- let paymentInAmountAsset = $t03944339595._5
940- let bonus = $t03944339595._4
941- let feeAmount = $t03944339595._3
942- let commonState = $t03944339595._2
943- let emitAmountEstimated = $t03944339595._1
1159+ let paymentInAmountAsset = $t04621746369._5
1160+ let bonus = $t04621746369._4
1161+ let feeAmount = $t04621746369._3
1162+ let commonState = $t04621746369._2
1163+ let emitAmountEstimated = $t04621746369._1
9441164 let emitAmount = if (if ((minOutAmount > 0))
9451165 then (minOutAmount > emitAmountEstimated)
9461166 else false)
9471167 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
9481168 else emitAmountEstimated
9491169 let emitInv = emit(emitAmount)
9501170 if ((emitInv == emitInv))
9511171 then {
9521172 let lpTransfer = if (autoStake)
9531173 then {
9541174 let stakeInv = invoke(stakingContract, "stake", nil, [AttachedPayment(cfgLpAssetId, emitAmount)])
9551175 if ((stakeInv == stakeInv))
9561176 then nil
9571177 else throw("Strict value is not equal to itself.")
9581178 }
9591179 else [ScriptTransfer(i.caller, emitAmount, cfgLpAssetId)]
9601180 let sendFee = if ((feeAmount > 0))
9611181 then [ScriptTransfer(feeCollectorAddress, feeAmount, paymentAssetId)]
9621182 else nil
963- let $t04018140378 = if ((this == feeCollectorAddress))
1183+ let $t04695547152 = if ((this == feeCollectorAddress))
9641184 then $Tuple2(0, 0)
9651185 else if (paymentInAmountAsset)
9661186 then $Tuple2(-(feeAmount), 0)
9671187 else $Tuple2(0, -(feeAmount))
968- let amountAssetBalanceDelta = $t04018140378._1
969- let priceAssetBalanceDelta = $t04018140378._2
970- let $t04038140489 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
971- let refreshKLpActions = $t04038140489._1
972- let updatedKLp = $t04038140489._2
1188+ let amountAssetBalanceDelta = $t04695547152._1
1189+ let priceAssetBalanceDelta = $t04695547152._2
1190+ let $t04715547263 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1191+ let refreshKLpActions = $t04715547263._1
1192+ let updatedKLp = $t04715547263._2
9731193 let kLp = value(getString(keyKLp))
9741194 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
9751195 if ((isUpdatedKLpValid == isUpdatedKLpValid))
976- then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
1196+ then {
1197+ let reb = invoke(this, "rebalance", nil, nil)
1198+ if ((reb == reb))
1199+ then $Tuple2((((commonState ++ lpTransfer) ++ sendFee) ++ refreshKLpActions), emitAmount)
1200+ else throw("Strict value is not equal to itself.")
1201+ }
9771202 else throw("Strict value is not equal to itself.")
9781203 }
9791204 else throw("Strict value is not equal to itself.")
9801205 }
9811206 else throw("Strict value is not equal to itself.")
9821207 }
9831208 else throw("Strict value is not equal to itself.")
9841209 }
9851210 else throw("Strict value is not equal to itself.")
9861211 }
9871212
9881213
9891214
9901215 @Callable(i)
9911216 func putOneTknREADONLY (paymentAssetId,paymentAmountRaw) = {
992- let $t04079540952 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
993- let emitAmountEstimated = $t04079540952._1
994- let commonState = $t04079540952._2
995- let feeAmount = $t04079540952._3
996- let bonus = $t04079540952._4
997- let paymentInAmountAsset = $t04079540952._5
1217+ let $t04761847775 = calcPutOneToken(paymentAmountRaw, parseAssetId(paymentAssetId), unit, unit)
1218+ let emitAmountEstimated = $t04761847775._1
1219+ let commonState = $t04761847775._2
1220+ let feeAmount = $t04761847775._3
1221+ let bonus = $t04761847775._4
1222+ let paymentInAmountAsset = $t04761847775._5
9981223 $Tuple2(nil, $Tuple3(emitAmountEstimated, feeAmount, bonus))
9991224 }
10001225
10011226
10021227
10031228 @Callable(i)
10041229 func getOneTkn (outAssetIdStr,minOutAmount) = {
10051230 let isPoolOneTokenOperationsDisabled = {
10061231 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
10071232 if ($isInstanceOf(@, "Boolean"))
10081233 then @
10091234 else throw(($getType(@) + " couldn't be cast to Boolean"))
10101235 }
10111236 let isGetDisabled = if (if (isGlobalShutdown())
10121237 then true
10131238 else (cfgPoolStatus == PoolShutdown))
10141239 then true
10151240 else isPoolOneTokenOperationsDisabled
10161241 let checks = [if (if (!(isGetDisabled))
10171242 then true
10181243 else isManager(i))
10191244 then true
10201245 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1))
10211246 then true
10221247 else throwErr("exactly 1 payment are expected")]
10231248 if ((checks == checks))
10241249 then {
10251250 let outAssetId = parseAssetId(outAssetIdStr)
10261251 let payment = i.payments[0]
10271252 let paymentAssetId = payment.assetId
10281253 let paymentAmount = payment.amount
10291254 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
10301255 if ((currentKLp == currentKLp))
10311256 then {
10321257 let userAddress = i.caller
10331258 let txId = i.transactionId
1034- let $t04183741990 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1035- if (($t04183741990 == $t04183741990))
1259+ let $t04866048813 = calcGetOneToken(outAssetId, paymentAmount, paymentAssetId, userAddress, txId)
1260+ if (($t04866048813 == $t04866048813))
10361261 then {
1037- let outInAmountAsset = $t04183741990._5
1038- let bonus = $t04183741990._4
1039- let feeAmount = $t04183741990._3
1040- let commonState = $t04183741990._2
1041- let amountEstimated = $t04183741990._1
1262+ let outInAmountAsset = $t04866048813._5
1263+ let bonus = $t04866048813._4
1264+ let feeAmount = $t04866048813._3
1265+ let commonState = $t04866048813._2
1266+ let amountEstimated = $t04866048813._1
10421267 let amount = if (if ((minOutAmount > 0))
10431268 then (minOutAmount > amountEstimated)
10441269 else false)
10451270 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
10461271 else amountEstimated
1272+ let lsConf = match getLeaseProxyConfig(outAssetIdStr) {
1273+ case a: (Boolean, Int, Int, String, String, Int, String) =>
1274+ a
1275+ case _ =>
1276+ throw("error lease config")
1277+ }
1278+ let $t04919749311 = lsConf
1279+ let isLeasable = $t04919749311._1
1280+ let leasedRatio = $t04919749311._2
1281+ let minBalance = $t04919749311._3
1282+ let proxyAddress = $t04919749311._4
1283+ let proxyAssetId = $t04919749311._5
1284+ let proxyRateMul = $t04919749311._6
1285+ let stakingProfitAddress = $t04919749311._7
1286+ let assetOnPool = assetBalance(this, fromBase58String(outAssetIdStr))
1287+ let amountOfProfit = if (if ((outAssetIdStr == "WAVES"))
1288+ then (amount > assetOnPool)
1289+ else false)
1290+ then {
1291+ let amountDiff = (amount - assetOnPool)
1292+ let oldRatio = (getAdditionalBalance(outAssetIdStr) / getStakingAssetBalance(sWavesId()))
1293+ let oldWavesRoughBalane = wavesBalance(this).available
1294+ let wd = invoke(this, "withdraw", [outAssetIdStr, amountDiff, sWavesId(), sWavesProxy(), proxyRateMul], nil)
1295+ if ((wd == wd))
1296+ then {
1297+ let newWavesRoughBalane = wavesBalance(this).available
1298+ let wavesDiff = (newWavesRoughBalane - oldWavesRoughBalane)
1299+ (wavesDiff - amountDiff)
1300+ }
1301+ else throw("Strict value is not equal to itself.")
1302+ }
1303+ else 0
1304+ let profitTransfer = [ScriptTransfer(addressFromStringValue(stakingProfitAddress), amountOfProfit, unit)]
10471305 let burnInv = invoke(factoryContract, "burn", [paymentAmount], [AttachedPayment(paymentAssetId, paymentAmount)])
10481306 if ((burnInv == burnInv))
10491307 then {
10501308 let assetTransfer = [ScriptTransfer(userAddress, amount, outAssetId)]
10511309 let sendFee = if ((feeAmount > 0))
10521310 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
10531311 else nil
1054- let $t04249042737 = {
1312+ let $t05035050597 = {
10551313 let feeAmountForCalc = if ((this == feeCollectorAddress))
10561314 then 0
10571315 else feeAmount
10581316 if (outInAmountAsset)
10591317 then $Tuple2(-((amount + feeAmountForCalc)), 0)
10601318 else $Tuple2(0, -((amount + feeAmountForCalc)))
10611319 }
1062- let amountAssetBalanceDelta = $t04249042737._1
1063- let priceAssetBalanceDelta = $t04249042737._2
1064- let $t04274042848 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1065- let refreshKLpActions = $t04274042848._1
1066- let updatedKLp = $t04274042848._2
1320+ let amountAssetBalanceDelta = $t05035050597._1
1321+ let priceAssetBalanceDelta = $t05035050597._2
1322+ let $t05060050708 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1323+ let refreshKLpActions = $t05060050708._1
1324+ let updatedKLp = $t05060050708._2
10671325 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
10681326 if ((isUpdatedKLpValid == isUpdatedKLpValid))
1069- then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1327+ then {
1328+ let reb = invoke(this, "rebalance", nil, nil)
1329+ if ((reb == reb))
1330+ then $Tuple2(((((commonState ++ assetTransfer) ++ profitTransfer) ++ sendFee) ++ refreshKLpActions), amount)
1331+ else throw("Strict value is not equal to itself.")
1332+ }
10701333 else throw("Strict value is not equal to itself.")
10711334 }
10721335 else throw("Strict value is not equal to itself.")
10731336 }
10741337 else throw("Strict value is not equal to itself.")
10751338 }
10761339 else throw("Strict value is not equal to itself.")
10771340 }
10781341 else throw("Strict value is not equal to itself.")
10791342 }
10801343
10811344
10821345
10831346 @Callable(i)
10841347 func getOneTknREADONLY (outAssetId,paymentAmount) = {
1085- let $t04310543261 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1086- let amountEstimated = $t04310543261._1
1087- let commonState = $t04310543261._2
1088- let feeAmount = $t04310543261._3
1089- let bonus = $t04310543261._4
1090- let outInAmountAsset = $t04310543261._5
1348+ let $t05103551191 = calcGetOneToken(parseAssetId(outAssetId), paymentAmount, cfgLpAssetId, unit, unit)
1349+ let amountEstimated = $t05103551191._1
1350+ let commonState = $t05103551191._2
1351+ let feeAmount = $t05103551191._3
1352+ let bonus = $t05103551191._4
1353+ let outInAmountAsset = $t05103551191._5
10911354 $Tuple2(nil, $Tuple3(amountEstimated, feeAmount, bonus))
10921355 }
10931356
10941357
10951358
10961359 @Callable(i)
10971360 func unstakeAndGetOneTkn (unstakeAmount,outAssetIdStr,minOutAmount) = {
10981361 let isPoolOneTokenOperationsDisabled = {
10991362 let @ = invoke(factoryContract, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil)
11001363 if ($isInstanceOf(@, "Boolean"))
11011364 then @
11021365 else throw(($getType(@) + " couldn't be cast to Boolean"))
11031366 }
11041367 let isGetDisabled = if (if (isGlobalShutdown())
11051368 then true
11061369 else (cfgPoolStatus == PoolShutdown))
11071370 then true
11081371 else isPoolOneTokenOperationsDisabled
11091372 let checks = [if (if (!(isGetDisabled))
11101373 then true
11111374 else isManager(i))
11121375 then true
11131376 else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0))
11141377 then true
11151378 else throwErr("no payments are expected")]
11161379 if ((checks == checks))
11171380 then {
11181381 let outAssetId = parseAssetId(outAssetIdStr)
11191382 let userAddress = i.caller
11201383 let txId = i.transactionId
11211384 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
11221385 if ((currentKLp == currentKLp))
11231386 then {
11241387 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
11251388 if ((unstakeInv == unstakeInv))
11261389 then {
1127- let $t04416644317 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1128- if (($t04416644317 == $t04416644317))
1390+ let $t05209652247 = calcGetOneToken(outAssetId, unstakeAmount, cfgLpAssetId, userAddress, txId)
1391+ if (($t05209652247 == $t05209652247))
11291392 then {
1130- let outInAmountAsset = $t04416644317._5
1131- let bonus = $t04416644317._4
1132- let feeAmount = $t04416644317._3
1133- let commonState = $t04416644317._2
1134- let amountEstimated = $t04416644317._1
1393+ let outInAmountAsset = $t05209652247._5
1394+ let bonus = $t05209652247._4
1395+ let feeAmount = $t05209652247._3
1396+ let commonState = $t05209652247._2
1397+ let amountEstimated = $t05209652247._1
11351398 let amount = if (if ((minOutAmount > 0))
11361399 then (minOutAmount > amountEstimated)
11371400 else false)
11381401 then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], ""))
11391402 else amountEstimated
11401403 let burnInv = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
11411404 if ((burnInv == burnInv))
11421405 then {
11431406 let assetTransfer = [ScriptTransfer(i.caller, amount, outAssetId)]
11441407 let sendFee = if ((feeAmount > 0))
11451408 then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetId)]
11461409 else nil
1147- let $t04481245059 = {
1410+ let $t05274252989 = {
11481411 let feeAmountForCalc = if ((this == feeCollectorAddress))
11491412 then 0
11501413 else feeAmount
11511414 if (outInAmountAsset)
11521415 then $Tuple2(-((amount + feeAmountForCalc)), 0)
11531416 else $Tuple2(0, -((amount + feeAmountForCalc)))
11541417 }
1155- let amountAssetBalanceDelta = $t04481245059._1
1156- let priceAssetBalanceDelta = $t04481245059._2
1157- let $t04506245170 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1158- let refreshKLpActions = $t04506245170._1
1159- let updatedKLp = $t04506245170._2
1418+ let amountAssetBalanceDelta = $t05274252989._1
1419+ let priceAssetBalanceDelta = $t05274252989._2
1420+ let $t05299253100 = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)
1421+ let refreshKLpActions = $t05299253100._1
1422+ let updatedKLp = $t05299253100._2
11601423 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11611424 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11621425 then $Tuple2((((commonState ++ assetTransfer) ++ sendFee) ++ refreshKLpActions), amount)
11631426 else throw("Strict value is not equal to itself.")
11641427 }
11651428 else throw("Strict value is not equal to itself.")
11661429 }
11671430 else throw("Strict value is not equal to itself.")
11681431 }
11691432 else throw("Strict value is not equal to itself.")
11701433 }
11711434 else throw("Strict value is not equal to itself.")
11721435 }
11731436 else throw("Strict value is not equal to itself.")
11741437 }
11751438
11761439
11771440
11781441 @Callable(i)
11791442 func get () = {
11801443 let res = commonGet(i)
11811444 let outAmtAmt = res._1
11821445 let outPrAmt = res._2
11831446 let pmtAmt = res._3
11841447 let pmtAssetId = res._4
11851448 let state = res._5
11861449 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
11871450 if ((currentKLp == currentKLp))
11881451 then {
11891452 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
11901453 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
11911454 then {
1192- let $t04611646198 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1193- let refreshKLpActions = $t04611646198._1
1194- let updatedKLp = $t04611646198._2
1455+ let $t05404654128 = refreshKLpInternal(-(outAmtAmt), -(outPrAmt), 0)
1456+ let refreshKLpActions = $t05404654128._1
1457+ let updatedKLp = $t05404654128._2
11951458 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
11961459 if ((isUpdatedKLpValid == isUpdatedKLpValid))
11971460 then (state ++ refreshKLpActions)
11981461 else throw("Strict value is not equal to itself.")
11991462 }
12001463 else throw("Strict value is not equal to itself.")
12011464 }
12021465 else throw("Strict value is not equal to itself.")
12031466 }
12041467
12051468
12061469
12071470 @Callable(i)
12081471 func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = {
12091472 let res = commonGet(i)
12101473 let outAmAmt = res._1
12111474 let outPrAmt = res._2
12121475 let pmtAmt = res._3
12131476 let pmtAssetId = res._4
12141477 let state = res._5
12151478 if ((noLessThenAmtAsset > outAmAmt))
12161479 then throw(((("noLessThenAmtAsset failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset)))
12171480 else if ((noLessThenPriceAsset > outPrAmt))
12181481 then throw(((("noLessThenPriceAsset failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset)))
12191482 else {
12201483 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12211484 if ((currentKLp == currentKLp))
12221485 then {
12231486 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)])
12241487 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
12251488 then {
1226- let $t04714747228 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1227- let refreshKLpActions = $t04714747228._1
1228- let updatedKLp = $t04714747228._2
1489+ let $t05507755158 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1490+ let refreshKLpActions = $t05507755158._1
1491+ let updatedKLp = $t05507755158._2
12291492 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12301493 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12311494 then (state ++ refreshKLpActions)
12321495 else throw("Strict value is not equal to itself.")
12331496 }
12341497 else throw("Strict value is not equal to itself.")
12351498 }
12361499 else throw("Strict value is not equal to itself.")
12371500 }
12381501 }
12391502
12401503
12411504
12421505 @Callable(i)
12431506 func unstakeAndGet (amount) = {
12441507 let checkPayments = if ((size(i.payments) != 0))
12451508 then throw("No payments are expected")
12461509 else true
12471510 if ((checkPayments == checkPayments))
12481511 then {
12491512 let cfg = getPoolConfig()
12501513 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
12511514 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
12521515 if ((currentKLp == currentKLp))
12531516 then {
12541517 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(lpAssetId), amount], nil)
12551518 if ((unstakeInv == unstakeInv))
12561519 then {
12571520 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller)
12581521 let outAmAmt = res._1
12591522 let outPrAmt = res._2
12601523 let poolStatus = parseIntValue(res._9)
12611524 let state = res._10
12621525 let checkPoolStatus = if (if (isGlobalShutdown())
12631526 then true
12641527 else (poolStatus == PoolShutdown))
12651528 then throw(("Get operation is blocked by admin. Status = " + toString(poolStatus)))
12661529 else true
12671530 if ((checkPoolStatus == checkPoolStatus))
12681531 then {
12691532 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [amount], [AttachedPayment(lpAssetId, amount)])
12701533 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
12711534 then {
1272- let $t04835448435 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1273- let refreshKLpActions = $t04835448435._1
1274- let updatedKLp = $t04835448435._2
1535+ let $t05628456365 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1536+ let refreshKLpActions = $t05628456365._1
1537+ let updatedKLp = $t05628456365._2
12751538 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
12761539 if ((isUpdatedKLpValid == isUpdatedKLpValid))
12771540 then (state ++ refreshKLpActions)
12781541 else throw("Strict value is not equal to itself.")
12791542 }
12801543 else throw("Strict value is not equal to itself.")
12811544 }
12821545 else throw("Strict value is not equal to itself.")
12831546 }
12841547 else throw("Strict value is not equal to itself.")
12851548 }
12861549 else throw("Strict value is not equal to itself.")
12871550 }
12881551 else throw("Strict value is not equal to itself.")
12891552 }
12901553
12911554
12921555
12931556 @Callable(i)
12941557 func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = {
12951558 let isGetDisabled = if (isGlobalShutdown())
12961559 then true
12971560 else (cfgPoolStatus == PoolShutdown)
12981561 let checks = [if (!(isGetDisabled))
12991562 then true
13001563 else throw("get operation is blocked by admin"), if ((size(i.payments) == 0))
13011564 then true
13021565 else throw("no payments are expected")]
13031566 if ((checks == checks))
13041567 then {
13051568 let currentKLp = calcCurrentKLp(toBigInt(0), toBigInt(0), toBigInt(0))
13061569 if ((currentKLp == currentKLp))
13071570 then {
13081571 let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil)
13091572 if ((unstakeInv == unstakeInv))
13101573 then {
13111574 let res = estimateGetOperation(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller)
13121575 let outAmAmt = res._1
13131576 let outPrAmt = res._2
13141577 let state = res._10
13151578 let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset))
13161579 then true
13171580 else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset))
13181581 then true
13191582 else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))]
13201583 if ((checkAmounts == checkAmounts))
13211584 then {
13221585 let burnLPAssetOnFactory = invoke(factoryContract, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)])
13231586 if ((burnLPAssetOnFactory == burnLPAssetOnFactory))
13241587 then {
1325- let $t04973049811 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1326- let refreshKLpActions = $t04973049811._1
1327- let updatedKLp = $t04973049811._2
1588+ let $t05766057741 = refreshKLpInternal(-(outAmAmt), -(outPrAmt), 0)
1589+ let refreshKLpActions = $t05766057741._1
1590+ let updatedKLp = $t05766057741._2
13281591 let isUpdatedKLpValid = validateUpdatedKLp(currentKLp, updatedKLp)
13291592 if ((isUpdatedKLpValid == isUpdatedKLpValid))
13301593 then (state ++ refreshKLpActions)
13311594 else throw("Strict value is not equal to itself.")
13321595 }
13331596 else throw("Strict value is not equal to itself.")
13341597 }
13351598 else throw("Strict value is not equal to itself.")
13361599 }
13371600 else throw("Strict value is not equal to itself.")
13381601 }
13391602 else throw("Strict value is not equal to itself.")
13401603 }
13411604 else throw("Strict value is not equal to itself.")
13421605 }
13431606
13441607
13451608
13461609 @Callable(i)
13471610 func activate (amtAssetStr,priceAssetStr) = if ((toString(i.caller) != toString(factoryContract)))
13481611 then throw("permissions denied")
13491612 else $Tuple2([StringEntry(aa(), amtAssetStr), StringEntry(pa(), priceAssetStr)], "success")
13501613
13511614
13521615
13531616 @Callable(i)
13541617 func refreshKLp () = {
13551618 let lastRefreshedBlockHeight = valueOrElse(getInteger(keyKLpRefreshedHeight), 0)
13561619 let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= kLpRefreshDelay))
13571620 then unit
13581621 else throwErr(makeString([toString(kLpRefreshDelay), " blocks have not passed since the previous call"], ""))
13591622 if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight))
13601623 then {
13611624 let kLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyKLp), "0")), fmtErr("invalid kLp"))
1362- let $t05099851062 = refreshKLpInternal(0, 0, 0)
1363- let kLpUpdateActions = $t05099851062._1
1364- let updatedKLp = $t05099851062._2
1625+ let $t05892858992 = refreshKLpInternal(0, 0, 0)
1626+ let kLpUpdateActions = $t05892858992._1
1627+ let updatedKLp = $t05892858992._2
13651628 let actions = if ((kLp != updatedKLp))
13661629 then kLpUpdateActions
13671630 else throwErr("nothing to refresh")
13681631 $Tuple2(actions, toString(updatedKLp))
13691632 }
13701633 else throw("Strict value is not equal to itself.")
13711634 }
13721635
13731636
13741637
13751638 @Callable(i)
13761639 func getPoolConfigWrapperREADONLY () = $Tuple2(nil, getPoolConfig())
13771640
13781641
13791642
13801643 @Callable(i)
13811644 func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId))
13821645
13831646
13841647
13851648 @Callable(i)
13861649 func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = {
13871650 let prices = calcPrices(amAmt, prAmt, lpAmt)
13881651 $Tuple2(nil, [toString(prices[0]), toString(prices[1]), toString(prices[2])])
13891652 }
13901653
13911654
13921655
13931656 @Callable(i)
13941657 func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(toX18(origVal, origScaleMult)))
13951658
13961659
13971660
13981661 @Callable(i)
13991662 func fromX18WrapperREADONLY (val,resultScaleMult) = $Tuple2(nil, fromX18(parseBigIntValue(val), resultScaleMult))
14001663
14011664
14021665
14031666 @Callable(i)
14041667 func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(calcPriceBigInt(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18))))
14051668
14061669
14071670
14081671 @Callable(i)
14091672 func estimatePutOperationWrapperREADONLY (txId58,slippageTolerance,inAmAssetAmt,inAmAssetId,inPrAssetAmt,inPrAssetId,userAddress,isEvaluate,emitLp) = $Tuple2(nil, estimatePutOperation(txId58, slippageTolerance, inAmAssetAmt, inAmAssetId, inPrAssetAmt, inPrAssetId, userAddress, isEvaluate, emitLp))
14101673
14111674
14121675
14131676 @Callable(i)
14141677 func estimateGetOperationWrapperREADONLY (txId58,pmtAssetId,pmtLpAmt,userAddress) = {
14151678 let res = estimateGetOperation(txId58, pmtAssetId, pmtLpAmt, addressFromStringValue(userAddress))
14161679 $Tuple2(nil, $Tuple10(res._1, res._2, res._3, res._4, res._5, res._6, res._7, toString(res._8), res._9, res._10))
14171680 }
14181681
14191682
14201683
14211684 @Callable(i)
14221685 func statsREADONLY () = {
14231686 let cfg = getPoolConfig()
14241687 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
14251688 let amtAssetId = cfg[idxAmtAssetId]
14261689 let priceAssetId = cfg[idxPriceAssetId]
14271690 let iAmtAssetId = cfg[idxIAmtAssetId]
14281691 let iPriceAssetId = cfg[idxIPriceAssetId]
14291692 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
14301693 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
14311694 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
14321695 let accAmtAssetBalance = getAccBalance(amtAssetId)
14331696 let accPriceAssetBalance = getAccBalance(priceAssetId)
14341697 let pricesList = if ((poolLPBalance == 0))
14351698 then [zeroBigInt, zeroBigInt, zeroBigInt]
14361699 else calcPrices(accAmtAssetBalance, accPriceAssetBalance, poolLPBalance)
14371700 let curPrice = 0
14381701 let lpAmtAssetShare = fromX18(pricesList[1], scale8)
14391702 let lpPriceAssetShare = fromX18(pricesList[2], scale8)
14401703 let poolWeight = value(getInteger(factoryContract, keyPoolWeight(toString(this))))
14411704 $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))
14421705 }
14431706
14441707
14451708
14461709 @Callable(i)
14471710 func evaluatePutByAmountAssetREADONLY (inAmAssetAmt) = {
14481711 let cfg = getPoolConfig()
14491712 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
14501713 let amAssetIdStr = cfg[idxAmtAssetId]
14511714 let amAssetId = fromBase58String(amAssetIdStr)
14521715 let prAssetIdStr = cfg[idxPriceAssetId]
14531716 let prAssetId = fromBase58String(prAssetIdStr)
14541717 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
14551718 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
14561719 let poolStatus = cfg[idxPoolStatus]
14571720 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
14581721 let accAmtAssetBalance = getAccBalance(amAssetIdStr)
14591722 let accPriceAssetBalance = getAccBalance(prAssetIdStr)
14601723 let amtAssetAmtX18 = toX18(accAmtAssetBalance, amtAssetDcm)
14611724 let priceAssetAmtX18 = toX18(accPriceAssetBalance, priceAssetDcm)
14621725 let curPriceX18 = if ((poolLPBalance == 0))
14631726 then zeroBigInt
14641727 else calcPriceBigInt(priceAssetAmtX18, amtAssetAmtX18)
14651728 let inAmAssetAmtX18 = toX18(inAmAssetAmt, amtAssetDcm)
14661729 let inPrAssetAmtX18 = fraction(inAmAssetAmtX18, curPriceX18, scale18)
14671730 let inPrAssetAmt = fromX18(inPrAssetAmtX18, priceAssetDcm)
14681731 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
14691732 let calcLpAmt = estPut._1
14701733 let curPriceCalc = estPut._3
14711734 let amBalance = estPut._4
14721735 let prBalance = estPut._5
14731736 let lpEmission = estPut._6
14741737 $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))
14751738 }
14761739
14771740
14781741
14791742 @Callable(i)
14801743 func evaluatePutByPriceAssetREADONLY (inPrAssetAmt) = {
14811744 let cfg = getPoolConfig()
14821745 let lpAssetId = fromBase58String(cfg[idxPoolLPAssetId])
14831746 let amAssetIdStr = cfg[idxAmtAssetId]
14841747 let amAssetId = fromBase58String(amAssetIdStr)
14851748 let prAssetIdStr = cfg[idxPriceAssetId]
14861749 let prAssetId = fromBase58String(prAssetIdStr)
14871750 let amtAssetDcm = parseIntValue(cfg[idxAmtAssetDcm])
14881751 let priceAssetDcm = parseIntValue(cfg[idxPriceAssetDcm])
14891752 let poolStatus = cfg[idxPoolStatus]
14901753 let poolLPBalance = valueOrErrorMessage(assetInfo(lpAssetId), (("Asset " + toBase58String(lpAssetId)) + " doesn't exist")).quantity
14911754 let amBalanceRaw = getAccBalance(amAssetIdStr)
14921755 let prBalanceRaw = getAccBalance(prAssetIdStr)
14931756 let amBalanceRawX18 = toX18(amBalanceRaw, amtAssetDcm)
14941757 let prBalanceRawX18 = toX18(prBalanceRaw, priceAssetDcm)
14951758 let curPriceX18 = if ((poolLPBalance == 0))
14961759 then zeroBigInt
14971760 else calcPriceBigInt(prBalanceRawX18, amBalanceRawX18)
14981761 let inPrAssetAmtX18 = toX18(inPrAssetAmt, priceAssetDcm)
14991762 let inAmAssetAmtX18 = fraction(inPrAssetAmtX18, scale18, curPriceX18)
15001763 let inAmAssetAmt = fromX18(inAmAssetAmtX18, amtAssetDcm)
15011764 let estPut = estimatePutOperation("", 500000, inAmAssetAmt, amAssetId, inPrAssetAmt, prAssetId, "", true, false)
15021765 let calcLpAmt = estPut._1
15031766 let curPriceCalc = estPut._3
15041767 let amBalance = estPut._4
15051768 let prBalance = estPut._5
15061769 let lpEmission = estPut._6
15071770 $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))
15081771 }
15091772
15101773
15111774
15121775 @Callable(i)
15131776 func evaluateGetREADONLY (paymentLpAssetId,paymentLpAmt) = {
15141777 let res = estimateGetOperation("", paymentLpAssetId, paymentLpAmt, this)
15151778 let outAmAmt = res._1
15161779 let outPrAmt = res._2
15171780 let amBalance = res._5
15181781 let prBalance = res._6
15191782 let lpEmission = res._7
15201783 let curPrice = res._8
15211784 let poolStatus = parseIntValue(res._9)
15221785 $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))
15231786 }
15241787
15251788
15261789 @Verifier(tx)
15271790 func verify () = {
15281791 let targetPublicKey = match managerPublicKeyOrUnit() {
15291792 case pk: ByteVector =>
15301793 pk
15311794 case _: Unit =>
15321795 tx.senderPublicKey
15331796 case _ =>
15341797 throw("Match error")
15351798 }
15361799 match tx {
15371800 case order: Order =>
15381801 let matcherPub = getMatcherPubOrFail()
1539- let $t05972459793 = validateMatcherOrderAllowed(order)
1540- let orderValid = $t05972459793._1
1541- let orderValidInfo = $t05972459793._2
1802+ let $t06765467723 = validateMatcherOrderAllowed(order)
1803+ let orderValid = $t06765467723._1
1804+ let orderValidInfo = $t06765467723._2
15421805 let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey)
15431806 let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub)
15441807 if (if (if (orderValid)
15451808 then senderValid
15461809 else false)
15471810 then matcherValid
15481811 else false)
15491812 then true
15501813 else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid)
15511814 case s: SetScriptTransaction =>
15521815 if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey))
15531816 then true
15541817 else {
15551818 let newHash = blake2b256(value(s.script))
15561819 let allowedHash = fromBase64String(value(getString(factoryContract, keyAllowedLpScriptHash())))
15571820 let currentHash = scriptHash(this)
15581821 if ((allowedHash == newHash))
15591822 then (currentHash != newHash)
15601823 else false
15611824 }
15621825 case _ =>
15631826 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
15641827 }
15651828 }
15661829

github/deemru/w8io/026f985 
240.59 ms