tx · 7w7DCGoHSiAGtfZ642bWpA4qyHp38nVx7emus16mV5zg 3MuibHtY4WMNqE2AgpPjm9fuDar6TUNCThP: -0.04000000 Waves 2023.05.04 14:24 [2562946] smart account 3MuibHtY4WMNqE2AgpPjm9fuDar6TUNCThP > SELF 0.00000000 Waves
{ "type": 13, "id": "7w7DCGoHSiAGtfZ642bWpA4qyHp38nVx7emus16mV5zg", "fee": 4000000, "feeAssetId": null, "timestamp": 1683199533361, "version": 2, "chainId": 84, "sender": "3MuibHtY4WMNqE2AgpPjm9fuDar6TUNCThP", "senderPublicKey": "5K6j2MTCQttt7Dt3hR4msP7sjtJ4LWVPHbUjbG485Lxw", "proofs": [ "3HsVAbGxqywNKxd2fC4qnS4zyG8jDTMm9g9hbtbjQw9WmzreTL8GLXx5GsPtsaWJRGWwqKJ1tGXZaR1UUBE3jY97" ], "script": "base64:BgKlKggCEgUKAwEEARIHCgUBBAEIARIDCgEIEgMKAQgSABIECgIBBBIECgIBBBIDCgEBEgASBAoCCAESABIECgIIARIECgIIARIECgIBARIDCgEBEgUKAwEBARIFCgMBCAESBAoCAQgSBAoCAQgSBAoCCAgSABIDCgEIEgUKAwEBARIECgIIARIECgIBARIECgIICBILCgkIAQECAQIIBAQSBgoECAgBCBIAIgZzY2FsZTgiDHNjYWxlOEJpZ0ludCIHc2NhbGUxOCIKemVyb0JpZ0ludCIEYmlnMCIEYmlnMSIEYmlnMiIEYmlnMyIEYmlnNCILd2F2ZXNTdHJpbmciCmFtcEluaXRpYWwiBUFtdWx0IgNTRVAiClBvb2xQdXREaXMiDlBvb2xNYXRjaGVyRGlzIgxQb29sU2h1dGRvd24iDmlkeFBvb2xBZGRyZXNzIglpZHhQb29sU3QiCWlkeExQQXNJZCIJaWR4QW1Bc0lkIglpZHhQckFzSWQiC2lkeEFtdEFzRGNtIg1pZHhQcmljZUFzRGNtIg9pZHhGYWN0U3Rha0NudHIiEmlkeEZhY3RvcnlSZXN0Q250ciIQaWR4RmFjdFNsaXBwQ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AmZZAAkAlAoCBgIACQECZUEBBQJlQgQCYXgIBQJoWgJfMQQCYXkIBQJoWgJfMgQCYXoJAPQDAwgFAmVCCWJvZHlCeXRlcwkAkQMCCAUCZUIGcHJvb2ZzAAAIBQJlQg9zZW5kZXJQdWJsaWNLZXkEAmFBCQD0AwMIBQJlQglib2R5Qnl0ZXMJAJEDAggFAmVCBnByb29mcwABBQJoWQMDAwUCYXgFAmF6BwUCYUEHBgkBAmF3BAUCYXgFAmF5BQJhegUCYUEDCQABAgUCZk4CFFNldFNjcmlwdFRyYW5zYWN0aW9uBAJjYwUCZk4DCQD0AwMIBQJoVglib2R5Qnl0ZXMJAJEDAggFAmhWBnByb29mcwAABQJoWAYEAmlhCQD2AwEJAQV2YWx1ZQEIBQJjYwZzY3JpcHQEAmliCQDbBAEJAQV2YWx1ZQEJAJ0IAgUCYUkJAQJhcwAEAmljCQDxBwEFBHRoaXMDCQAAAgUCaWIFAmlhCQECIT0CBQJpYwUCaWEHCQD0AwMIBQJoVglib2R5Qnl0ZXMJAJEDAggFAmhWBnByb29mcwAABQJoWKTIBrQ=", "height": 2562946, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8grKf57nX8XULXZeLhTpppPpJGYeJTisJsr9BN27jfqb Next: 5uQwzpnfzzVeAj3sR4JWNdDQw4zCjXk4o36DX4pPzYFk Diff:
Old | New | Differences | |
---|---|---|---|
19 | 19 | ||
20 | 20 | let big4 = toBigInt(4) | |
21 | 21 | ||
22 | - | let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8))) | |
23 | - | ||
24 | 22 | let wavesString = "WAVES" | |
25 | 23 | ||
26 | 24 | let ampInitial = 50 | |
27 | 25 | ||
28 | 26 | let Amult = "100" | |
29 | 27 | ||
30 | - | let Dconv = "1" | |
31 | - | ||
32 | 28 | let SEP = "__" | |
33 | - | ||
34 | - | let EMPTY = "" | |
35 | - | ||
36 | - | let PoolActive = 1 | |
37 | 29 | ||
38 | 30 | let PoolPutDis = 2 | |
39 | 31 | ||
55 | 47 | ||
56 | 48 | let idxPriceAsDcm = 7 | |
57 | 49 | ||
58 | - | let idxIAmtAsId = 8 | |
59 | - | ||
60 | - | let idxIPriceAsId = 9 | |
61 | - | ||
62 | 50 | let idxFactStakCntr = 1 | |
63 | 51 | ||
64 | 52 | let idxFactoryRestCntr = 6 | |
65 | 53 | ||
66 | 54 | let idxFactSlippCntr = 7 | |
67 | - | ||
68 | - | let idxFactGwxRewCntr = 10 | |
69 | 55 | ||
70 | 56 | let feeDefault = fraction(10, scale8, 10000) | |
71 | 57 | ||
79 | 65 | ||
80 | 66 | ||
81 | 67 | func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round)) | |
82 | - | ||
83 | - | ||
84 | - | func t2 (origVal,origScaleMult) = fraction(origVal, scale18, toBigInt(origScaleMult)) | |
85 | - | ||
86 | - | ||
87 | - | func f2 (val,resultScaleMult) = fraction(val, toBigInt(resultScaleMult), scale18) | |
88 | - | ||
89 | - | ||
90 | - | func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
91 | 68 | ||
92 | 69 | ||
93 | 70 | func abs (val) = if ((zeroBigInt > val)) | |
234 | 211 | else toBase58String(value(input)) | |
235 | 212 | ||
236 | 213 | ||
237 | - | func parsePoolConfig (poolConfig) = $ | |
214 | + | func parsePoolConfig (poolConfig) = $Tuple7(addressFromStringValue(poolConfig[idxPoolAddress]), parseIntValue(poolConfig[idxPoolSt]), fromBase58String(poolConfig[idxLPAsId]), parseAssetId(poolConfig[idxAmAsId]), parseAssetId(poolConfig[idxPrAsId]), parseIntValue(poolConfig[idxAmtAsDcm]), parseIntValue(poolConfig[idxPriceAsDcm])) | |
238 | 215 | ||
239 | 216 | ||
240 | 217 | let poolConfigParsed = parsePoolConfig(gpc()) | |
241 | 218 | ||
242 | - | let $ | |
219 | + | let $t080878273 = poolConfigParsed | |
243 | 220 | ||
244 | - | let | |
221 | + | let cfgPoolStatus = $t080878273._2 | |
245 | 222 | ||
246 | - | let | |
223 | + | let cfgLpAssetId = $t080878273._3 | |
247 | 224 | ||
248 | - | let | |
225 | + | let cfgAmountAssetId = $t080878273._4 | |
249 | 226 | ||
250 | - | let | |
227 | + | let cfgPriceAssetId = $t080878273._5 | |
251 | 228 | ||
252 | - | let | |
229 | + | let cfgAmountAssetDecimals = $t080878273._6 | |
253 | 230 | ||
254 | - | let cfgAmountAssetDecimals = $t081858414._6 | |
255 | - | ||
256 | - | let cfgPriceAssetDecimals = $t081858414._7 | |
257 | - | ||
258 | - | let cfgInAmountAssedId = $t081858414._8 | |
259 | - | ||
260 | - | let cfgInPriceAssetId = $t081858414._9 | |
231 | + | let cfgPriceAssetDecimals = $t080878273._7 | |
261 | 232 | ||
262 | 233 | func gfc () = split(strf(fca, fcfg()), SEP) | |
263 | 234 | ||
265 | 236 | let factoryConfig = gfc() | |
266 | 237 | ||
267 | 238 | let stakingContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactStakCntr]), "Invalid staking contract address") | |
268 | - | ||
269 | - | let slipageContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactSlippCntr]), "Invalid slipage contract address") | |
270 | - | ||
271 | - | let gwxContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactGwxRewCntr]), "Invalid gwx contract address") | |
272 | 239 | ||
273 | 240 | let restContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactoryRestCntr]), "Invalid gwx contract address") | |
274 | 241 | ||
289 | 256 | func cpbir (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round) | |
290 | 257 | ||
291 | 258 | ||
292 | - | func vad (A1,A2,slippage) = { | |
293 | - | let diff = fraction((A1 - A2), scale8BigInt, A2) | |
294 | - | let pass = ((slippage - abs(diff)) > zeroBigInt) | |
295 | - | if (!(pass)) | |
296 | - | then throw(("Big slpg: " + toString(diff))) | |
297 | - | else $Tuple2(pass, min([A1, A2])) | |
298 | - | } | |
299 | - | ||
300 | - | ||
301 | - | func vd (D1,D0,slpg) = { | |
302 | - | let diff = fraction(D0, scale8BigInt, D1) | |
303 | - | let fail = (slpg > diff) | |
304 | - | if (if (fail) | |
305 | - | then true | |
306 | - | else (D0 > D1)) | |
307 | - | then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg))) | |
308 | - | else fail | |
309 | - | } | |
310 | - | ||
311 | - | ||
312 | 259 | func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
313 | 260 | let amtAsAmtX18 = t1(amAmt, amAssetDcm) | |
314 | 261 | let prAsAmtX18 = t1(prAmt, prAssetDcm) | |
326 | 273 | let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18) | |
327 | 274 | let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18) | |
328 | 275 | [priceX18, lpPrInAmAsX18, lpPrInPrAsX18] | |
329 | - | } | |
330 | - | ||
331 | - | ||
332 | - | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
333 | - | let p = calcPrices(amAmt, prAmt, lpAmt) | |
334 | - | [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)] | |
335 | 276 | } | |
336 | 277 | ||
337 | 278 | ||
378 | 319 | } | |
379 | 320 | ||
380 | 321 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] | |
381 | - | let $ | |
322 | + | let $t01277812826 = { | |
382 | 323 | let $l = arr | |
383 | 324 | let $s = size($l) | |
384 | 325 | let $acc0 = $Tuple2(s, false) | |
392 | 333 | ||
393 | 334 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17) | |
394 | 335 | } | |
395 | - | let d = $ | |
396 | - | let found = $ | |
336 | + | let d = $t01277812826._1 | |
337 | + | let found = $t01277812826._2 | |
397 | 338 | if (found) | |
398 | 339 | then d | |
399 | 340 | else throw(("D calculation error, D = " + toString(d))) | |
440 | 381 | let lpId = cfgLpAssetId | |
441 | 382 | let amIdStr = toBase58String(value(cfgAmountAssetId)) | |
442 | 383 | let prIdStr = toBase58String(value(cfgPriceAssetId)) | |
443 | - | let inAmIdStr = cfgInAmountAssedId | |
444 | - | let inPrIdStr = cfgInPriceAssetId | |
445 | 384 | let amtDcm = cfgAmountAssetDecimals | |
446 | 385 | let priceDcm = cfgPriceAssetDecimals | |
447 | 386 | let sts = toString(cfgPoolStatus) | |
529 | 468 | else calcLpAmt | |
530 | 469 | let amDiff = (inAmAmt - calcAmAssetPmt) | |
531 | 470 | let prDiff = (inPrAmt - calcPrAssetPmt) | |
532 | - | let $ | |
471 | + | let $t02058820933 = if (if (isOneAsset) | |
533 | 472 | then (pmtId == amIdStr) | |
534 | 473 | else false) | |
535 | 474 | then $Tuple2(pmtAmt, 0) | |
538 | 477 | else false) | |
539 | 478 | then $Tuple2(0, pmtAmt) | |
540 | 479 | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
541 | - | let writeAmAmt = $ | |
542 | - | let writePrAmt = $ | |
480 | + | let writeAmAmt = $t02058820933._1 | |
481 | + | let writePrAmt = $t02058820933._2 | |
543 | 482 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(writeAmAmt, writePrAmt, emitLpAmt, curPrice, slippage, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))] | |
544 | 483 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
545 | 484 | } | |
558 | 497 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
559 | 498 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
560 | 499 | func calc (acc,cur) = { | |
561 | - | let $ | |
562 | - | let y = $ | |
563 | - | let found = $ | |
500 | + | let $t02212822148 = acc | |
501 | + | let y = $t02212822148._1 | |
502 | + | let found = $t02212822148._2 | |
564 | 503 | if ((found != unit)) | |
565 | 504 | then acc | |
566 | 505 | else { | |
573 | 512 | } | |
574 | 513 | ||
575 | 514 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
576 | - | let $ | |
515 | + | let $t02245522502 = { | |
577 | 516 | let $l = arr | |
578 | 517 | let $s = size($l) | |
579 | 518 | let $acc0 = $Tuple2(D, unit) | |
587 | 526 | ||
588 | 527 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
589 | 528 | } | |
590 | - | let y = $ | |
591 | - | let found = $ | |
529 | + | let y = $t02245522502._1 | |
530 | + | let found = $t02245522502._2 | |
592 | 531 | if ((found != unit)) | |
593 | 532 | then y | |
594 | 533 | else throw(("Y calculation error, Y = " + toString(y))) | |
632 | 571 | let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
633 | 572 | let amountAssetAmount = order.amount | |
634 | 573 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
635 | - | let $ | |
574 | + | let $t02470024912 = if ((order.orderType == Buy)) | |
636 | 575 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
637 | 576 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
638 | - | let amountAssetBalanceDelta = $ | |
639 | - | let priceAssetBalanceDelta = $ | |
577 | + | let amountAssetBalanceDelta = $t02470024912._1 | |
578 | + | let priceAssetBalanceDelta = $t02470024912._2 | |
640 | 579 | if (if (if (igs()) | |
641 | 580 | then true | |
642 | 581 | else (cfgPoolStatus == PoolMatcherDis)) | |
649 | 588 | then throw("Wr assets") | |
650 | 589 | else { | |
651 | 590 | let dLp = parseBigIntValue(valueOrElse(getString(this, keyDLp), "0")) | |
652 | - | let $ | |
653 | - | let unusedActions = $ | |
654 | - | let dLpNew = $ | |
591 | + | let $t02525425354 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
592 | + | let unusedActions = $t02525425354._1 | |
593 | + | let dLpNew = $t02525425354._2 | |
655 | 594 | let isOrderValid = (dLpNew >= dLp) | |
656 | 595 | let info = makeString(["dLp=", toString(dLp), " dLpNew=", toString(dLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "") | |
657 | 596 | $Tuple2(isOrderValid, info) | |
705 | 644 | then { | |
706 | 645 | let amBalance = getAccBalance(amId) | |
707 | 646 | let prBalance = getAccBalance(prId) | |
708 | - | let $ | |
647 | + | let $t02801028472 = if ((txId == "")) | |
709 | 648 | then $Tuple2(amBalance, prBalance) | |
710 | 649 | else if ((pmtAssetId == amId)) | |
711 | 650 | then if ((pmtAmtRaw > amBalance)) | |
716 | 655 | then throw("invalid payment amount") | |
717 | 656 | else $Tuple2(amBalance, (prBalance - pmtAmtRaw)) | |
718 | 657 | else throw("wrong pmtAssetId") | |
719 | - | let amBalanceOld = $ | |
720 | - | let prBalanceOld = $ | |
721 | - | let $ | |
658 | + | let amBalanceOld = $t02801028472._1 | |
659 | + | let prBalanceOld = $t02801028472._2 | |
660 | + | let $t02847828654 = if ((pmtAssetId == amId)) | |
722 | 661 | then $Tuple2(pmtAmtRaw, 0) | |
723 | 662 | else if ((pmtAssetId == prId)) | |
724 | 663 | then $Tuple2(0, pmtAmtRaw) | |
725 | 664 | else throw("invalid payment") | |
726 | - | let amAmountRaw = $ | |
727 | - | let prAmountRaw = $ | |
728 | - | let $ | |
665 | + | let amAmountRaw = $t02847828654._1 | |
666 | + | let prAmountRaw = $t02847828654._2 | |
667 | + | let $t02865828912 = if (withTakeFee) | |
729 | 668 | then $Tuple3(takeFee(amAmountRaw, inFee)._1, takeFee(prAmountRaw, inFee)._1, takeFee(pmtAmtRaw, inFee)._2) | |
730 | 669 | else $Tuple3(amAmountRaw, prAmountRaw, 0) | |
731 | - | let amAmount = $ | |
732 | - | let prAmount = $ | |
733 | - | let feeAmount = $ | |
670 | + | let amAmount = $t02865828912._1 | |
671 | + | let prAmount = $t02865828912._2 | |
672 | + | let feeAmount = $t02865828912._3 | |
734 | 673 | let amBalanceNew = (amBalanceOld + amAmount) | |
735 | 674 | let prBalanceNew = (prBalanceOld + prAmount) | |
736 | 675 | let D0 = getD([t1(amBalanceOld, cfgAmountAssetDecimals), t1(prBalanceOld, cfgPriceAssetDecimals)]) | |
778 | 717 | else { | |
779 | 718 | let amBalance = getAccBalance(amId) | |
780 | 719 | let prBalance = getAccBalance(prId) | |
781 | - | let $ | |
720 | + | let $t03102431135 = { | |
782 | 721 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil) | |
783 | 722 | if ($isInstanceOf(@, "(Int, Int)")) | |
784 | 723 | then @ | |
785 | 724 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
786 | 725 | } | |
787 | - | if (($ | |
726 | + | if (($t03102431135 == $t03102431135)) | |
788 | 727 | then { | |
789 | - | let feeAmount = $ | |
790 | - | let totalGet = $ | |
728 | + | let feeAmount = $t03102431135._2 | |
729 | + | let totalGet = $t03102431135._1 | |
791 | 730 | let totalAmount = if (if ((minOutAmount > 0)) | |
792 | 731 | then (minOutAmount > totalGet) | |
793 | 732 | else false) | |
794 | 733 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
795 | 734 | else totalGet | |
796 | - | let $ | |
735 | + | let $t03132531632 = if ((outAssetId == amId)) | |
797 | 736 | then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance) | |
798 | 737 | else if ((outAssetId == prId)) | |
799 | 738 | then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount)) | |
800 | 739 | else throw("invalid out asset id") | |
801 | - | let outAm = $ | |
802 | - | let outPr = $ | |
803 | - | let amBalanceNew = $ | |
804 | - | let prBalanceNew = $ | |
740 | + | let outAm = $t03132531632._1 | |
741 | + | let outPr = $t03132531632._2 | |
742 | + | let amBalanceNew = $t03132531632._3 | |
743 | + | let prBalanceNew = $t03132531632._4 | |
805 | 744 | let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals)) | |
806 | 745 | let curPr = f1(curPrX18, scale8) | |
807 | 746 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
816 | 755 | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
817 | 756 | if ((burn == burn)) | |
818 | 757 | then { | |
819 | - | let $ | |
758 | + | let $t03241732767 = { | |
820 | 759 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
821 | 760 | then 0 | |
822 | 761 | else feeAmount | |
827 | 766 | then $Tuple2(-((totalGet + feeAmountForCalc)), 0) | |
828 | 767 | else $Tuple2(0, -((totalGet + feeAmountForCalc))) | |
829 | 768 | } | |
830 | - | let amountAssetBalanceDelta = $ | |
831 | - | let priceAssetBalanceDelta = $ | |
832 | - | let $ | |
833 | - | let refreshDLpActions = $ | |
834 | - | let updatedDLp = $ | |
769 | + | let amountAssetBalanceDelta = $t03241732767._1 | |
770 | + | let priceAssetBalanceDelta = $t03241732767._2 | |
771 | + | let $t03277032878 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
772 | + | let refreshDLpActions = $t03277032878._1 | |
773 | + | let updatedDLp = $t03277032878._2 | |
835 | 774 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
836 | 775 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
837 | 776 | then $Tuple2((state ++ refreshDLpActions), totalAmount) | |
910 | 849 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
911 | 850 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
912 | 851 | func calc (acc,cur) = { | |
913 | - | let $ | |
914 | - | let y = $ | |
915 | - | let found = $ | |
852 | + | let $t03432534345 = acc | |
853 | + | let y = $t03432534345._1 | |
854 | + | let found = $t03432534345._2 | |
916 | 855 | if ((found != unit)) | |
917 | 856 | then acc | |
918 | 857 | else { | |
925 | 864 | } | |
926 | 865 | ||
927 | 866 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
928 | - | let $ | |
867 | + | let $t03467634723 = { | |
929 | 868 | let $l = arr | |
930 | 869 | let $s = size($l) | |
931 | 870 | let $acc0 = $Tuple2(D, unit) | |
939 | 878 | ||
940 | 879 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
941 | 880 | } | |
942 | - | let y = $ | |
943 | - | let found = $ | |
881 | + | let y = $t03467634723._1 | |
882 | + | let found = $t03467634723._2 | |
944 | 883 | if ((found != unit)) | |
945 | 884 | then y | |
946 | 885 | else throw(("Y calculation error, Y = " + toString(y))) | |
952 | 891 | ||
953 | 892 | @Callable(i) | |
954 | 893 | func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = { | |
955 | - | let $ | |
894 | + | let $t03507535499 = if ((isReverse == false)) | |
956 | 895 | then { | |
957 | 896 | let assetOut = strf(this, pa()) | |
958 | 897 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, aa()))) + toBigInt(cleanAmountIn)) | |
963 | 902 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, pa()))) + toBigInt(cleanAmountIn)) | |
964 | 903 | $Tuple2(assetOut, poolAmountInBalance) | |
965 | 904 | } | |
966 | - | let assetOut = $ | |
967 | - | let poolAmountInBalance = $ | |
905 | + | let assetOut = $t03507535499._1 | |
906 | + | let poolAmountInBalance = $t03507535499._2 | |
968 | 907 | let poolConfig = gpc() | |
969 | 908 | let amId = poolConfig[idxAmAsId] | |
970 | 909 | let prId = poolConfig[idxPrAsId] | |
1004 | 943 | then { | |
1005 | 944 | let pmt = value(i.payments[0]) | |
1006 | 945 | let assetIn = assetIdToString(pmt.assetId) | |
1007 | - | let $ | |
946 | + | let $t03693537329 = if ((isReverse == false)) | |
1008 | 947 | then { | |
1009 | 948 | let assetOut = strf(this, pa()) | |
1010 | 949 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1015 | 954 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1016 | 955 | $Tuple2(assetOut, poolAmountInBalance) | |
1017 | 956 | } | |
1018 | - | let assetOut = $ | |
1019 | - | let poolAmountInBalance = $ | |
957 | + | let assetOut = $t03693537329._1 | |
958 | + | let poolAmountInBalance = $t03693537329._2 | |
1020 | 959 | let poolConfig = gpc() | |
1021 | 960 | let amId = poolConfig[idxAmAsId] | |
1022 | 961 | let prId = poolConfig[idxPrAsId] | |
1156 | 1095 | else throw("Strict value is not equal to itself.") | |
1157 | 1096 | } | |
1158 | 1097 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
1159 | - | let $ | |
1160 | - | let refreshDLpActions = $ | |
1161 | - | let updatedDLp = $ | |
1098 | + | let $t04194842090 = refreshDLpInternal(0, 0, 0) | |
1099 | + | let refreshDLpActions = $t04194842090._1 | |
1100 | + | let updatedDLp = $t04194842090._2 | |
1162 | 1101 | let check = if ((updatedDLp >= currentDLp)) | |
1163 | 1102 | then true | |
1164 | 1103 | else throwErr(makeString(["updated DLp lower than current DLp", toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentDLp), toString(updatedDLp), toString(amDiff), toString(prDiff)], " ")) | |
1231 | 1170 | else calcCurrentDLp(toBigInt(0), toBigInt(pmtAmt), toBigInt(0)) | |
1232 | 1171 | if ((currentDLp == currentDLp)) | |
1233 | 1172 | then { | |
1234 | - | let $ | |
1235 | - | if (($ | |
1173 | + | let $t04373143889 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
1174 | + | if (($t04373143889 == $t04373143889)) | |
1236 | 1175 | then { | |
1237 | - | let feeAmount = $ | |
1238 | - | let state = $ | |
1239 | - | let estimLP = $ | |
1176 | + | let feeAmount = $t04373143889._3 | |
1177 | + | let state = $t04373143889._2 | |
1178 | + | let estimLP = $t04373143889._1 | |
1240 | 1179 | let emitLpAmt = if (if ((minOutAmount > 0)) | |
1241 | 1180 | then (minOutAmount > estimLP) | |
1242 | 1181 | else false) | |
1264 | 1203 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
1265 | 1204 | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
1266 | 1205 | else nil | |
1267 | - | let $ | |
1206 | + | let $t04477445123 = if ((this == feeCollectorAddress)) | |
1268 | 1207 | then $Tuple2(0, 0) | |
1269 | 1208 | else { | |
1270 | 1209 | let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId)) | |
1274 | 1213 | then $Tuple2(-(feeAmount), 0) | |
1275 | 1214 | else $Tuple2(0, -(feeAmount)) | |
1276 | 1215 | } | |
1277 | - | let amountAssetBalanceDelta = $ | |
1278 | - | let priceAssetBalanceDelta = $ | |
1279 | - | let $ | |
1280 | - | let refreshDLpActions = $ | |
1281 | - | let updatedDLp = $ | |
1216 | + | let amountAssetBalanceDelta = $t04477445123._1 | |
1217 | + | let priceAssetBalanceDelta = $t04477445123._2 | |
1218 | + | let $t04512645234 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1219 | + | let refreshDLpActions = $t04512645234._1 | |
1220 | + | let updatedDLp = $t04512645234._2 | |
1282 | 1221 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1283 | 1222 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1284 | 1223 | then $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt) | |
1310 | 1249 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1311 | 1250 | if ((currentDLp == currentDLp)) | |
1312 | 1251 | then { | |
1313 | - | let $ | |
1314 | - | let refreshDLpActions = $ | |
1315 | - | let updatedDLp = $ | |
1252 | + | let $t04626446329 = refreshDLpInternal(0, 0, 0) | |
1253 | + | let refreshDLpActions = $t04626446329._1 | |
1254 | + | let updatedDLp = $t04626446329._2 | |
1316 | 1255 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1317 | 1256 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1318 | 1257 | then (state ++ refreshDLpActions) | |
1337 | 1276 | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1338 | 1277 | if ((b == b)) | |
1339 | 1278 | then { | |
1340 | - | let $ | |
1341 | - | let refreshDLpActions = $ | |
1342 | - | let updatedDLp = $ | |
1279 | + | let $t04750247584 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1280 | + | let refreshDLpActions = $t04750247584._1 | |
1281 | + | let updatedDLp = $t04750247584._2 | |
1343 | 1282 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1344 | 1283 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1345 | 1284 | then (state ++ refreshDLpActions) | |
1374 | 1313 | else throwErr("exactly 1 payment are expected")] | |
1375 | 1314 | if ((checks == checks)) | |
1376 | 1315 | then { | |
1377 | - | let $ | |
1378 | - | let state = $ | |
1379 | - | let totalAmount = $ | |
1316 | + | let $t04820248357 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1317 | + | let state = $t04820248357._1 | |
1318 | + | let totalAmount = $t04820248357._2 | |
1380 | 1319 | $Tuple2(state, totalAmount) | |
1381 | 1320 | } | |
1382 | 1321 | else throw("Strict value is not equal to itself.") | |
1393 | 1332 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1394 | 1333 | then { | |
1395 | 1334 | let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp")) | |
1396 | - | let $ | |
1397 | - | let dLpUpdateActions = $ | |
1398 | - | let updatedDLp = $ | |
1335 | + | let $t04888148945 = refreshDLpInternal(0, 0, 0) | |
1336 | + | let dLpUpdateActions = $t04888148945._1 | |
1337 | + | let updatedDLp = $t04888148945._2 | |
1399 | 1338 | let actions = if ((dLp != updatedDLp)) | |
1400 | 1339 | then dLpUpdateActions | |
1401 | 1340 | else throwErr("nothing to refresh") | |
1423 | 1362 | let newY = getYD(xp, index, D1) | |
1424 | 1363 | let dy = (xp[index] - newY) | |
1425 | 1364 | let totalGetRaw = max([0, toInt((dy - big1))]) | |
1426 | - | let $ | |
1427 | - | let totalGet = $ | |
1428 | - | let feeAmount = $ | |
1365 | + | let $t04995550010 = takeFee(totalGetRaw, outFee) | |
1366 | + | let totalGet = $t04995550010._1 | |
1367 | + | let feeAmount = $t04995550010._2 | |
1429 | 1368 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1430 | 1369 | } | |
1431 | 1370 | ||
1438 | 1377 | let lpId = toBase58String(value(cfgLpAssetId)) | |
1439 | 1378 | let amBalance = getAccBalance(amId) | |
1440 | 1379 | let prBalance = getAccBalance(prId) | |
1441 | - | let $ | |
1380 | + | let $t05038550500 = { | |
1442 | 1381 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1443 | 1382 | if ($isInstanceOf(@, "(Int, Int)")) | |
1444 | 1383 | then @ | |
1445 | 1384 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
1446 | 1385 | } | |
1447 | - | let totalGet = $ | |
1448 | - | let feeAmount = $ | |
1386 | + | let totalGet = $t05038550500._1 | |
1387 | + | let feeAmount = $t05038550500._2 | |
1449 | 1388 | let r = ego("", lpId, lpAssetAmount, this) | |
1450 | 1389 | let outAmAmt = r._1 | |
1451 | 1390 | let outPrAmt = r._2 | |
1479 | 1418 | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1480 | 1419 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1481 | 1420 | then { | |
1482 | - | let $ | |
1483 | - | let refreshDLpActions = $ | |
1484 | - | let updatedDLp = $ | |
1421 | + | let $t05166651747 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1422 | + | let refreshDLpActions = $t05166651747._1 | |
1423 | + | let updatedDLp = $t05166651747._2 | |
1485 | 1424 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1486 | 1425 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1487 | 1426 | then (state ++ refreshDLpActions) | |
1526 | 1465 | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1527 | 1466 | if ((burnA == burnA)) | |
1528 | 1467 | then { | |
1529 | - | let $ | |
1530 | - | let refreshDLpActions = $ | |
1531 | - | let updatedDLp = $ | |
1468 | + | let $t05277452855 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1469 | + | let refreshDLpActions = $t05277452855._1 | |
1470 | + | let updatedDLp = $t05277452855._2 | |
1532 | 1471 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1533 | 1472 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1534 | 1473 | then (state ++ refreshDLpActions) | |
1579 | 1518 | let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1580 | 1519 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1581 | 1520 | then { | |
1582 | - | let $ | |
1583 | - | let refreshDLpActions = $ | |
1584 | - | let updatedDLp = $ | |
1521 | + | let $t05410654187 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1522 | + | let refreshDLpActions = $t05410654187._1 | |
1523 | + | let updatedDLp = $t05410654187._2 | |
1585 | 1524 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1586 | 1525 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1587 | 1526 | then (state ++ refreshDLpActions) | |
1630 | 1569 | let unstakeInv = invoke(staking, "unstakeINTERNAL", [lpAssetId, unstakeAmount, userAddress.bytes, lpAssetRecipientAddress.bytes], nil) | |
1631 | 1570 | if ((unstakeInv == unstakeInv)) | |
1632 | 1571 | then { | |
1633 | - | let $ | |
1634 | - | let state = $ | |
1635 | - | let totalAmount = $ | |
1572 | + | let $t05520955397 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1573 | + | let state = $t05520955397._1 | |
1574 | + | let totalAmount = $t05520955397._2 | |
1636 | 1575 | $Tuple2(state, totalAmount) | |
1637 | 1576 | } | |
1638 | 1577 | else throw("Strict value is not equal to itself.") | |
1644 | 1583 | ||
1645 | 1584 | @Callable(i) | |
1646 | 1585 | func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1647 | - | let $ | |
1648 | - | let lpAmount = $ | |
1649 | - | let state = $ | |
1650 | - | let feeAmount = $ | |
1651 | - | let bonus = $ | |
1586 | + | let $t05552555628 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true) | |
1587 | + | let lpAmount = $t05552555628._1 | |
1588 | + | let state = $t05552555628._2 | |
1589 | + | let feeAmount = $t05552555628._3 | |
1590 | + | let bonus = $t05552555628._4 | |
1652 | 1591 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1653 | 1592 | } | |
1654 | 1593 | ||
1656 | 1595 | ||
1657 | 1596 | @Callable(i) | |
1658 | 1597 | func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1659 | - | let $ | |
1660 | - | let lpAmount = $ | |
1661 | - | let state = $ | |
1662 | - | let feeAmount = $ | |
1663 | - | let bonus = $ | |
1598 | + | let $t05577655880 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false) | |
1599 | + | let lpAmount = $t05577655880._1 | |
1600 | + | let state = $t05577655880._2 | |
1601 | + | let feeAmount = $t05577655880._3 | |
1602 | + | let bonus = $t05577655880._4 | |
1664 | 1603 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1665 | 1604 | } | |
1666 | 1605 | ||
1722 | 1661 | @Callable(i) | |
1723 | 1662 | func changeAmp () = { | |
1724 | 1663 | let cfg = invoke(fca, "getChangeAmpConfigREADONLY", [toString(this)], nil) | |
1725 | - | let $ | |
1664 | + | let $t05828958488 = match cfg { | |
1726 | 1665 | case list: List[Any] => | |
1727 | 1666 | $Tuple3({ | |
1728 | 1667 | let @ = list[0] | |
1743 | 1682 | case _ => | |
1744 | 1683 | throwErr("invalid entry type") | |
1745 | 1684 | } | |
1746 | - | let delay = $ | |
1747 | - | let delta = $ | |
1748 | - | let target = $ | |
1685 | + | let delay = $t05828958488._1 | |
1686 | + | let delta = $t05828958488._2 | |
1687 | + | let target = $t05828958488._3 | |
1749 | 1688 | let curAmp = parseIntValue(getStringValue(amp())) | |
1750 | 1689 | let newAmpRaw = (curAmp + delta) | |
1751 | 1690 | let newAmp = if ((0 > delta)) | |
1781 | 1720 | match tx { | |
1782 | 1721 | case order: Order => | |
1783 | 1722 | let matcherPub = mp() | |
1784 | - | let $ | |
1723 | + | let $t05940059517 = if (skipOrderValidation()) | |
1785 | 1724 | then $Tuple2(true, "") | |
1786 | 1725 | else validateMatcherOrderAllowed(order) | |
1787 | - | let orderValid = $ | |
1788 | - | let orderValidInfo = $ | |
1726 | + | let orderValid = $t05940059517._1 | |
1727 | + | let orderValidInfo = $t05940059517._2 | |
1789 | 1728 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1790 | 1729 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1791 | 1730 | if (if (if (orderValid) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let scale8 = 100000000 | |
5 | 5 | ||
6 | 6 | let scale8BigInt = toBigInt(100000000) | |
7 | 7 | ||
8 | 8 | let scale18 = toBigInt(1000000000000000000) | |
9 | 9 | ||
10 | 10 | let zeroBigInt = toBigInt(0) | |
11 | 11 | ||
12 | 12 | let big0 = toBigInt(0) | |
13 | 13 | ||
14 | 14 | let big1 = toBigInt(1) | |
15 | 15 | ||
16 | 16 | let big2 = toBigInt(2) | |
17 | 17 | ||
18 | 18 | let big3 = toBigInt(3) | |
19 | 19 | ||
20 | 20 | let big4 = toBigInt(4) | |
21 | 21 | ||
22 | - | let slippage4D = toBigInt((scale8 - ((scale8 * 1) / scale8))) | |
23 | - | ||
24 | 22 | let wavesString = "WAVES" | |
25 | 23 | ||
26 | 24 | let ampInitial = 50 | |
27 | 25 | ||
28 | 26 | let Amult = "100" | |
29 | 27 | ||
30 | - | let Dconv = "1" | |
31 | - | ||
32 | 28 | let SEP = "__" | |
33 | - | ||
34 | - | let EMPTY = "" | |
35 | - | ||
36 | - | let PoolActive = 1 | |
37 | 29 | ||
38 | 30 | let PoolPutDis = 2 | |
39 | 31 | ||
40 | 32 | let PoolMatcherDis = 3 | |
41 | 33 | ||
42 | 34 | let PoolShutdown = 4 | |
43 | 35 | ||
44 | 36 | let idxPoolAddress = 1 | |
45 | 37 | ||
46 | 38 | let idxPoolSt = 2 | |
47 | 39 | ||
48 | 40 | let idxLPAsId = 3 | |
49 | 41 | ||
50 | 42 | let idxAmAsId = 4 | |
51 | 43 | ||
52 | 44 | let idxPrAsId = 5 | |
53 | 45 | ||
54 | 46 | let idxAmtAsDcm = 6 | |
55 | 47 | ||
56 | 48 | let idxPriceAsDcm = 7 | |
57 | 49 | ||
58 | - | let idxIAmtAsId = 8 | |
59 | - | ||
60 | - | let idxIPriceAsId = 9 | |
61 | - | ||
62 | 50 | let idxFactStakCntr = 1 | |
63 | 51 | ||
64 | 52 | let idxFactoryRestCntr = 6 | |
65 | 53 | ||
66 | 54 | let idxFactSlippCntr = 7 | |
67 | - | ||
68 | - | let idxFactGwxRewCntr = 10 | |
69 | 55 | ||
70 | 56 | let feeDefault = fraction(10, scale8, 10000) | |
71 | 57 | ||
72 | 58 | func t1 (origVal,origScaleMult) = fraction(toBigInt(origVal), scale18, toBigInt(origScaleMult)) | |
73 | 59 | ||
74 | 60 | ||
75 | 61 | func t1BigInt (origVal,origScaleMult) = fraction(origVal, scale18, origScaleMult) | |
76 | 62 | ||
77 | 63 | ||
78 | 64 | func f1 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), scale18)) | |
79 | 65 | ||
80 | 66 | ||
81 | 67 | func fromX18Round (val,resultScaleMult,round) = toInt(fraction(val, toBigInt(resultScaleMult), scale18, round)) | |
82 | - | ||
83 | - | ||
84 | - | func t2 (origVal,origScaleMult) = fraction(origVal, scale18, toBigInt(origScaleMult)) | |
85 | - | ||
86 | - | ||
87 | - | func f2 (val,resultScaleMult) = fraction(val, toBigInt(resultScaleMult), scale18) | |
88 | - | ||
89 | - | ||
90 | - | func ts (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
91 | 68 | ||
92 | 69 | ||
93 | 70 | func abs (val) = if ((zeroBigInt > val)) | |
94 | 71 | then -(val) | |
95 | 72 | else val | |
96 | 73 | ||
97 | 74 | ||
98 | 75 | func absBigInt (val) = if ((zeroBigInt > val)) | |
99 | 76 | then -(val) | |
100 | 77 | else val | |
101 | 78 | ||
102 | 79 | ||
103 | 80 | func fc () = "%s__factoryContract" | |
104 | 81 | ||
105 | 82 | ||
106 | 83 | func mpk () = "%s__managerPublicKey" | |
107 | 84 | ||
108 | 85 | ||
109 | 86 | func pmpk () = "%s__pendingManagerPublicKey" | |
110 | 87 | ||
111 | 88 | ||
112 | 89 | func pl () = "%s%s__price__last" | |
113 | 90 | ||
114 | 91 | ||
115 | 92 | func ph (h,t) = makeString(["%s%s%d%d__price__history", toString(h), toString(t)], SEP) | |
116 | 93 | ||
117 | 94 | ||
118 | 95 | func pau (ua,txId) = ((("%s%s%s__P__" + ua) + "__") + txId) | |
119 | 96 | ||
120 | 97 | ||
121 | 98 | func gau (ua,txId) = ((("%s%s%s__G__" + ua) + "__") + txId) | |
122 | 99 | ||
123 | 100 | ||
124 | 101 | func aa () = "%s__amountAsset" | |
125 | 102 | ||
126 | 103 | ||
127 | 104 | func pa () = "%s__priceAsset" | |
128 | 105 | ||
129 | 106 | ||
130 | 107 | func amp () = "%s__amp" | |
131 | 108 | ||
132 | 109 | ||
133 | 110 | func keyAmpHistory (heightBlocks) = ("%s%d__amp__" + toString(heightBlocks)) | |
134 | 111 | ||
135 | 112 | ||
136 | 113 | func keyChangeAmpLastCall () = "%s__changeAmpLastCall" | |
137 | 114 | ||
138 | 115 | ||
139 | 116 | let keyFee = "%s__fee" | |
140 | 117 | ||
141 | 118 | let fee = valueOrElse(getInteger(this, keyFee), feeDefault) | |
142 | 119 | ||
143 | 120 | let keyDLp = makeString(["%s", "dLp"], SEP) | |
144 | 121 | ||
145 | 122 | let keyDLpRefreshedHeight = makeString(["%s", "dLpRefreshedHeight"], SEP) | |
146 | 123 | ||
147 | 124 | let keyDLpRefreshDelay = makeString(["%s", "refreshDLpDelay"], SEP) | |
148 | 125 | ||
149 | 126 | let dLpRefreshDelayDefault = 30 | |
150 | 127 | ||
151 | 128 | let dLpRefreshDelay = valueOrElse(getInteger(this, keyDLpRefreshDelay), dLpRefreshDelayDefault) | |
152 | 129 | ||
153 | 130 | func fcfg () = "%s__factoryConfig" | |
154 | 131 | ||
155 | 132 | ||
156 | 133 | func mtpk () = "%s%s__matcher__publicKey" | |
157 | 134 | ||
158 | 135 | ||
159 | 136 | func pc (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config") | |
160 | 137 | ||
161 | 138 | ||
162 | 139 | func mba (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr) | |
163 | 140 | ||
164 | 141 | ||
165 | 142 | func aps () = "%s__shutdown" | |
166 | 143 | ||
167 | 144 | ||
168 | 145 | func keyAllowedLpStableScriptHash () = "%s__allowedLpStableScriptHash" | |
169 | 146 | ||
170 | 147 | ||
171 | 148 | func keyFeeCollectorAddress () = "%s__feeCollectorAddress" | |
172 | 149 | ||
173 | 150 | ||
174 | 151 | func keySkipOrderValidation (poolAddress) = ("%s%s__skipOrderValidation__" + poolAddress) | |
175 | 152 | ||
176 | 153 | ||
177 | 154 | func throwOrderError (orderValid,orderValidInfo,senderValid,matcherValid) = throw((((((((("order validation failed: orderValid=" + toString(orderValid)) + " (") + orderValidInfo) + ")") + " senderValid=") + toString(senderValid)) + " matcherValid=") + toString(matcherValid))) | |
178 | 155 | ||
179 | 156 | ||
180 | 157 | func strf (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
181 | 158 | ||
182 | 159 | ||
183 | 160 | func intf (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
184 | 161 | ||
185 | 162 | ||
186 | 163 | func throwErr (msg) = throw(makeString(["lp_stable.ride:", msg], " ")) | |
187 | 164 | ||
188 | 165 | ||
189 | 166 | func fmtErr (msg) = makeString(["lp_stable.ride:", msg], " ") | |
190 | 167 | ||
191 | 168 | ||
192 | 169 | let fca = addressFromStringValue(strf(this, fc())) | |
193 | 170 | ||
194 | 171 | let inFee = { | |
195 | 172 | let @ = invoke(fca, "getInFeeREADONLY", [toString(this)], nil) | |
196 | 173 | if ($isInstanceOf(@, "Int")) | |
197 | 174 | then @ | |
198 | 175 | else throw(($getType(@) + " couldn't be cast to Int")) | |
199 | 176 | } | |
200 | 177 | ||
201 | 178 | let outFee = { | |
202 | 179 | let @ = invoke(fca, "getOutFeeREADONLY", [toString(this)], nil) | |
203 | 180 | if ($isInstanceOf(@, "Int")) | |
204 | 181 | then @ | |
205 | 182 | else throw(($getType(@) + " couldn't be cast to Int")) | |
206 | 183 | } | |
207 | 184 | ||
208 | 185 | let A = strf(this, amp()) | |
209 | 186 | ||
210 | 187 | func igs () = valueOrElse(getBoolean(fca, aps()), false) | |
211 | 188 | ||
212 | 189 | ||
213 | 190 | func mp () = fromBase58String(strf(fca, mtpk())) | |
214 | 191 | ||
215 | 192 | ||
216 | 193 | let feeCollectorAddress = addressFromStringValue(strf(fca, keyFeeCollectorAddress())) | |
217 | 194 | ||
218 | 195 | func gpc () = { | |
219 | 196 | let amtAs = strf(this, aa()) | |
220 | 197 | let priceAs = strf(this, pa()) | |
221 | 198 | let iPriceAs = intf(fca, mba(priceAs)) | |
222 | 199 | let iAmtAs = intf(fca, mba(amtAs)) | |
223 | 200 | split(strf(fca, pc(toString(iAmtAs), toString(iPriceAs))), SEP) | |
224 | 201 | } | |
225 | 202 | ||
226 | 203 | ||
227 | 204 | func parseAssetId (input) = if ((input == wavesString)) | |
228 | 205 | then unit | |
229 | 206 | else fromBase58String(input) | |
230 | 207 | ||
231 | 208 | ||
232 | 209 | func assetIdToString (input) = if ((input == unit)) | |
233 | 210 | then wavesString | |
234 | 211 | else toBase58String(value(input)) | |
235 | 212 | ||
236 | 213 | ||
237 | - | func parsePoolConfig (poolConfig) = $ | |
214 | + | func parsePoolConfig (poolConfig) = $Tuple7(addressFromStringValue(poolConfig[idxPoolAddress]), parseIntValue(poolConfig[idxPoolSt]), fromBase58String(poolConfig[idxLPAsId]), parseAssetId(poolConfig[idxAmAsId]), parseAssetId(poolConfig[idxPrAsId]), parseIntValue(poolConfig[idxAmtAsDcm]), parseIntValue(poolConfig[idxPriceAsDcm])) | |
238 | 215 | ||
239 | 216 | ||
240 | 217 | let poolConfigParsed = parsePoolConfig(gpc()) | |
241 | 218 | ||
242 | - | let $ | |
219 | + | let $t080878273 = poolConfigParsed | |
243 | 220 | ||
244 | - | let | |
221 | + | let cfgPoolStatus = $t080878273._2 | |
245 | 222 | ||
246 | - | let | |
223 | + | let cfgLpAssetId = $t080878273._3 | |
247 | 224 | ||
248 | - | let | |
225 | + | let cfgAmountAssetId = $t080878273._4 | |
249 | 226 | ||
250 | - | let | |
227 | + | let cfgPriceAssetId = $t080878273._5 | |
251 | 228 | ||
252 | - | let | |
229 | + | let cfgAmountAssetDecimals = $t080878273._6 | |
253 | 230 | ||
254 | - | let cfgAmountAssetDecimals = $t081858414._6 | |
255 | - | ||
256 | - | let cfgPriceAssetDecimals = $t081858414._7 | |
257 | - | ||
258 | - | let cfgInAmountAssedId = $t081858414._8 | |
259 | - | ||
260 | - | let cfgInPriceAssetId = $t081858414._9 | |
231 | + | let cfgPriceAssetDecimals = $t080878273._7 | |
261 | 232 | ||
262 | 233 | func gfc () = split(strf(fca, fcfg()), SEP) | |
263 | 234 | ||
264 | 235 | ||
265 | 236 | let factoryConfig = gfc() | |
266 | 237 | ||
267 | 238 | let stakingContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactStakCntr]), "Invalid staking contract address") | |
268 | - | ||
269 | - | let slipageContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactSlippCntr]), "Invalid slipage contract address") | |
270 | - | ||
271 | - | let gwxContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactGwxRewCntr]), "Invalid gwx contract address") | |
272 | 239 | ||
273 | 240 | let restContract = valueOrErrorMessage(addressFromString(factoryConfig[idxFactoryRestCntr]), "Invalid gwx contract address") | |
274 | 241 | ||
275 | 242 | func dataPutActionInfo (inAmtAssetAmt,inPriceAssetAmt,outLpAmt,price,slipByUser,slippageReal,txHeight,txTimestamp,slipageAmAmt,slipagePrAmt) = makeString(["%d%d%d%d%d%d%d%d%d%d", toString(inAmtAssetAmt), toString(inPriceAssetAmt), toString(outLpAmt), toString(price), toString(slipByUser), toString(slippageReal), toString(txHeight), toString(txTimestamp), toString(slipageAmAmt), toString(slipagePrAmt)], SEP) | |
276 | 243 | ||
277 | 244 | ||
278 | 245 | 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) | |
279 | 246 | ||
280 | 247 | ||
281 | 248 | func getAccBalance (assetId) = if ((assetId == "WAVES")) | |
282 | 249 | then wavesBalance(this).available | |
283 | 250 | else assetBalance(this, fromBase58String(assetId)) | |
284 | 251 | ||
285 | 252 | ||
286 | 253 | func cpbi (prAmtX18,amAmtX18) = fraction(prAmtX18, scale18, amAmtX18) | |
287 | 254 | ||
288 | 255 | ||
289 | 256 | func cpbir (prAmtX18,amAmtX18,round) = fraction(prAmtX18, scale18, amAmtX18, round) | |
290 | 257 | ||
291 | 258 | ||
292 | - | func vad (A1,A2,slippage) = { | |
293 | - | let diff = fraction((A1 - A2), scale8BigInt, A2) | |
294 | - | let pass = ((slippage - abs(diff)) > zeroBigInt) | |
295 | - | if (!(pass)) | |
296 | - | then throw(("Big slpg: " + toString(diff))) | |
297 | - | else $Tuple2(pass, min([A1, A2])) | |
298 | - | } | |
299 | - | ||
300 | - | ||
301 | - | func vd (D1,D0,slpg) = { | |
302 | - | let diff = fraction(D0, scale8BigInt, D1) | |
303 | - | let fail = (slpg > diff) | |
304 | - | if (if (fail) | |
305 | - | then true | |
306 | - | else (D0 > D1)) | |
307 | - | then throw(((((((toString(D0) + " ") + toString(D1)) + " ") + toString(diff)) + " ") + toString(slpg))) | |
308 | - | else fail | |
309 | - | } | |
310 | - | ||
311 | - | ||
312 | 259 | func pcp (amAssetDcm,prAssetDcm,amAmt,prAmt) = { | |
313 | 260 | let amtAsAmtX18 = t1(amAmt, amAssetDcm) | |
314 | 261 | let prAsAmtX18 = t1(prAmt, prAssetDcm) | |
315 | 262 | cpbi(prAsAmtX18, amtAsAmtX18) | |
316 | 263 | } | |
317 | 264 | ||
318 | 265 | ||
319 | 266 | func calcPrices (amAmt,prAmt,lpAmt) = { | |
320 | 267 | let amtAsDcm = cfgAmountAssetDecimals | |
321 | 268 | let prAsDcm = cfgPriceAssetDecimals | |
322 | 269 | let priceX18 = pcp(amtAsDcm, prAsDcm, amAmt, prAmt) | |
323 | 270 | let amAmtX18 = t1(amAmt, amtAsDcm) | |
324 | 271 | let prAmtX18 = t1(prAmt, prAsDcm) | |
325 | 272 | let lpAmtX18 = t1(lpAmt, scale8) | |
326 | 273 | let lpPrInAmAsX18 = cpbi(amAmtX18, lpAmtX18) | |
327 | 274 | let lpPrInPrAsX18 = cpbi(prAmtX18, lpAmtX18) | |
328 | 275 | [priceX18, lpPrInAmAsX18, lpPrInPrAsX18] | |
329 | - | } | |
330 | - | ||
331 | - | ||
332 | - | func calculatePrices (amAmt,prAmt,lpAmt) = { | |
333 | - | let p = calcPrices(amAmt, prAmt, lpAmt) | |
334 | - | [f1(p[0], scale8), f1(p[1], scale8), f1(p[2], scale8)] | |
335 | 276 | } | |
336 | 277 | ||
337 | 278 | ||
338 | 279 | func takeFee (amount,fee) = { | |
339 | 280 | let feeAmount = if ((fee == 0)) | |
340 | 281 | then 0 | |
341 | 282 | else fraction(amount, fee, scale8) | |
342 | 283 | $Tuple2((amount - feeAmount), feeAmount) | |
343 | 284 | } | |
344 | 285 | ||
345 | 286 | ||
346 | 287 | func getD (xp) = { | |
347 | 288 | let xp0 = xp[0] | |
348 | 289 | let xp1 = xp[1] | |
349 | 290 | let s = (xp0 + xp1) | |
350 | 291 | if ((s == big0)) | |
351 | 292 | then big0 | |
352 | 293 | else { | |
353 | 294 | let a = parseIntValue(A) | |
354 | 295 | let ann = (a * 2) | |
355 | 296 | let p = fraction(xp0, xp1, big1) | |
356 | 297 | let xp0_xp1_n_n = fraction(p, big4, big1) | |
357 | 298 | let ann_s = fraction(toBigInt(ann), s, big1) | |
358 | 299 | let ann_1 = toBigInt((ann - 1)) | |
359 | 300 | func calcDNext (d) = { | |
360 | 301 | let dd = fraction(d, d, big1) | |
361 | 302 | let ddd = fraction(dd, d, big1) | |
362 | 303 | let dp = fraction(ddd, big1, xp0_xp1_n_n) | |
363 | 304 | fraction((ann_s + fraction(dp, big2, big1)), d, (fraction(ann_1, d, big1) + fraction(big3, dp, big1))) | |
364 | 305 | } | |
365 | 306 | ||
366 | 307 | func calc (acc,i) = if (acc._2) | |
367 | 308 | then acc | |
368 | 309 | else { | |
369 | 310 | let d = acc._1 | |
370 | 311 | let dNext = calcDNext(d) | |
371 | 312 | let dDiffRaw = (dNext - value(d)) | |
372 | 313 | let dDiff = if ((big0 > dDiffRaw)) | |
373 | 314 | then -(dDiffRaw) | |
374 | 315 | else dDiffRaw | |
375 | 316 | if ((big1 >= dDiff)) | |
376 | 317 | then $Tuple2(dNext, true) | |
377 | 318 | else $Tuple2(dNext, false) | |
378 | 319 | } | |
379 | 320 | ||
380 | 321 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] | |
381 | - | let $ | |
322 | + | let $t01277812826 = { | |
382 | 323 | let $l = arr | |
383 | 324 | let $s = size($l) | |
384 | 325 | let $acc0 = $Tuple2(s, false) | |
385 | 326 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
386 | 327 | then $a | |
387 | 328 | else calc($a, $l[$i]) | |
388 | 329 | ||
389 | 330 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
390 | 331 | then $a | |
391 | 332 | else throw("List size exceeds 17") | |
392 | 333 | ||
393 | 334 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17) | |
394 | 335 | } | |
395 | - | let d = $ | |
396 | - | let found = $ | |
336 | + | let d = $t01277812826._1 | |
337 | + | let found = $t01277812826._2 | |
397 | 338 | if (found) | |
398 | 339 | then d | |
399 | 340 | else throw(("D calculation error, D = " + toString(d))) | |
400 | 341 | } | |
401 | 342 | } | |
402 | 343 | ||
403 | 344 | ||
404 | 345 | func ego (txId58,pmtAssetId,pmtLpAmt,userAddress) = { | |
405 | 346 | let lpId = cfgLpAssetId | |
406 | 347 | let amId = toBase58String(value(cfgAmountAssetId)) | |
407 | 348 | let prId = toBase58String(value(cfgPriceAssetId)) | |
408 | 349 | let amDcm = cfgAmountAssetDecimals | |
409 | 350 | let prDcm = cfgPriceAssetDecimals | |
410 | 351 | let sts = toString(cfgPoolStatus) | |
411 | 352 | let lpEmiss = valueOrErrorMessage(assetInfo(lpId), "Wrong LP id").quantity | |
412 | 353 | if ((toBase58String(lpId) != pmtAssetId)) | |
413 | 354 | then throw("Wrong pmt asset") | |
414 | 355 | else { | |
415 | 356 | let amBalance = getAccBalance(amId) | |
416 | 357 | let amBalanceX18 = t1(amBalance, amDcm) | |
417 | 358 | let prBalance = getAccBalance(prId) | |
418 | 359 | let prBalanceX18 = t1(prBalance, prDcm) | |
419 | 360 | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
420 | 361 | let curPrice = f1(curPriceX18, scale8) | |
421 | 362 | let pmtLpAmtX18 = t1(pmtLpAmt, scale8) | |
422 | 363 | let lpEmissX18 = t1(lpEmiss, scale8) | |
423 | 364 | let outAmAmtX18 = fraction(amBalanceX18, pmtLpAmtX18, lpEmissX18) | |
424 | 365 | let outPrAmtX18 = fraction(prBalanceX18, pmtLpAmtX18, lpEmissX18) | |
425 | 366 | let outAmAmt = fromX18Round(outAmAmtX18, amDcm, FLOOR) | |
426 | 367 | let outPrAmt = fromX18Round(outPrAmtX18, prDcm, FLOOR) | |
427 | 368 | let state = if ((txId58 == "")) | |
428 | 369 | then nil | |
429 | 370 | else [ScriptTransfer(userAddress, outAmAmt, if ((amId == "WAVES")) | |
430 | 371 | then unit | |
431 | 372 | else fromBase58String(amId)), ScriptTransfer(userAddress, outPrAmt, if ((prId == "WAVES")) | |
432 | 373 | then unit | |
433 | 374 | else fromBase58String(prId)), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAmAmt, outPrAmt, pmtLpAmt, curPrice, height, lastBlock.timestamp)), IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice)] | |
434 | 375 | $Tuple10(outAmAmt, outPrAmt, amId, prId, amBalance, prBalance, lpEmiss, curPriceX18, sts, state) | |
435 | 376 | } | |
436 | 377 | } | |
437 | 378 | ||
438 | 379 | ||
439 | 380 | func epo (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,userAddress,isEval,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = { | |
440 | 381 | let lpId = cfgLpAssetId | |
441 | 382 | let amIdStr = toBase58String(value(cfgAmountAssetId)) | |
442 | 383 | let prIdStr = toBase58String(value(cfgPriceAssetId)) | |
443 | - | let inAmIdStr = cfgInAmountAssedId | |
444 | - | let inPrIdStr = cfgInPriceAssetId | |
445 | 384 | let amtDcm = cfgAmountAssetDecimals | |
446 | 385 | let priceDcm = cfgPriceAssetDecimals | |
447 | 386 | let sts = toString(cfgPoolStatus) | |
448 | 387 | let lpEm = valueOrErrorMessage(assetInfo(lpId), "Wr lp as").quantity | |
449 | 388 | let amBalance = if (isEval) | |
450 | 389 | then getAccBalance(amIdStr) | |
451 | 390 | else if (if (isOneAsset) | |
452 | 391 | then (pmtId == amIdStr) | |
453 | 392 | else false) | |
454 | 393 | then (getAccBalance(amIdStr) - pmtAmt) | |
455 | 394 | else if (isOneAsset) | |
456 | 395 | then getAccBalance(amIdStr) | |
457 | 396 | else (getAccBalance(amIdStr) - inAmAmt) | |
458 | 397 | let prBalance = if (isEval) | |
459 | 398 | then getAccBalance(prIdStr) | |
460 | 399 | else if (if (isOneAsset) | |
461 | 400 | then (pmtId == prIdStr) | |
462 | 401 | else false) | |
463 | 402 | then (getAccBalance(prIdStr) - pmtAmt) | |
464 | 403 | else if (isOneAsset) | |
465 | 404 | then getAccBalance(prIdStr) | |
466 | 405 | else (getAccBalance(prIdStr) - inPrAmt) | |
467 | 406 | let inAmAssetAmtX18 = t1(inAmAmt, amtDcm) | |
468 | 407 | let inPrAssetAmtX18 = t1(inPrAmt, priceDcm) | |
469 | 408 | let userPriceX18 = cpbi(inPrAssetAmtX18, inAmAssetAmtX18) | |
470 | 409 | let amBalanceX18 = t1(amBalance, amtDcm) | |
471 | 410 | let prBalanceX18 = t1(prBalance, priceDcm) | |
472 | 411 | let D0 = getD([amBalanceX18, prBalanceX18]) | |
473 | 412 | let r = if ((lpEm == 0)) | |
474 | 413 | then { | |
475 | 414 | let D1 = getD([(amBalanceX18 + inAmAssetAmtX18), (prBalanceX18 + inPrAssetAmtX18)]) | |
476 | 415 | let checkD = if ((D1 > D0)) | |
477 | 416 | then true | |
478 | 417 | else throw("D1 should be greater than D0") | |
479 | 418 | if ((checkD == checkD)) | |
480 | 419 | then { | |
481 | 420 | let curPriceX18 = zeroBigInt | |
482 | 421 | let slippageX18 = zeroBigInt | |
483 | 422 | let lpAmtX18 = D1 | |
484 | 423 | $Tuple5(f1(lpAmtX18, scale8), f1(inAmAssetAmtX18, amtDcm), f1(inPrAssetAmtX18, priceDcm), cpbi((prBalanceX18 + inPrAssetAmtX18), (amBalanceX18 + inAmAssetAmtX18)), slippageX18) | |
485 | 424 | } | |
486 | 425 | else throw("Strict value is not equal to itself.") | |
487 | 426 | } | |
488 | 427 | else { | |
489 | 428 | let curPriceX18 = cpbi(prBalanceX18, amBalanceX18) | |
490 | 429 | let slippageRealX18 = fraction(abs((curPriceX18 - userPriceX18)), scale18, curPriceX18) | |
491 | 430 | let slippageX18 = t1(slippage, scale8) | |
492 | 431 | if (if (if (validateSlippage) | |
493 | 432 | then (curPriceX18 != zeroBigInt) | |
494 | 433 | else false) | |
495 | 434 | then (slippageRealX18 > slippageX18) | |
496 | 435 | else false) | |
497 | 436 | then throw(((("Price slippage " + toString(slippageRealX18)) + " > ") + toString(slippageX18))) | |
498 | 437 | else { | |
499 | 438 | let lpEmissionX18 = t1(lpEm, scale8) | |
500 | 439 | let prViaAmX18 = fraction(inAmAssetAmtX18, cpbir(prBalanceX18, amBalanceX18, CEILING), scale18, CEILING) | |
501 | 440 | let amViaPrX18 = fraction(inPrAssetAmtX18, scale18, cpbir(prBalanceX18, amBalanceX18, FLOOR), CEILING) | |
502 | 441 | let expectedAmts = if ((prViaAmX18 > inPrAssetAmtX18)) | |
503 | 442 | then $Tuple2(amViaPrX18, inPrAssetAmtX18) | |
504 | 443 | else $Tuple2(inAmAssetAmtX18, prViaAmX18) | |
505 | 444 | let expAmtAssetAmtX18 = expectedAmts._1 | |
506 | 445 | let expPriceAssetAmtX18 = expectedAmts._2 | |
507 | 446 | let D1 = getD([(amBalanceX18 + expAmtAssetAmtX18), (prBalanceX18 + expPriceAssetAmtX18)]) | |
508 | 447 | let checkD = if ((D1 > D0)) | |
509 | 448 | then true | |
510 | 449 | else throw("D1 should be greater than D0") | |
511 | 450 | if ((checkD == checkD)) | |
512 | 451 | then { | |
513 | 452 | let lpAmtX18 = fraction(lpEmissionX18, (D1 - D0), D0) | |
514 | 453 | $Tuple5(fromX18Round(lpAmtX18, scale8, FLOOR), fromX18Round(expAmtAssetAmtX18, amtDcm, CEILING), fromX18Round(expPriceAssetAmtX18, priceDcm, CEILING), curPriceX18, slippageX18) | |
515 | 454 | } | |
516 | 455 | else throw("Strict value is not equal to itself.") | |
517 | 456 | } | |
518 | 457 | } | |
519 | 458 | let calcLpAmt = r._1 | |
520 | 459 | let calcAmAssetPmt = r._2 | |
521 | 460 | let calcPrAssetPmt = r._3 | |
522 | 461 | let curPrice = f1(r._4, scale8) | |
523 | 462 | let slippageCalc = f1(r._5, scale8) | |
524 | 463 | if ((0 >= calcLpAmt)) | |
525 | 464 | then throw("LP <= 0") | |
526 | 465 | else { | |
527 | 466 | let emitLpAmt = if (!(emitLp)) | |
528 | 467 | then 0 | |
529 | 468 | else calcLpAmt | |
530 | 469 | let amDiff = (inAmAmt - calcAmAssetPmt) | |
531 | 470 | let prDiff = (inPrAmt - calcPrAssetPmt) | |
532 | - | let $ | |
471 | + | let $t02058820933 = if (if (isOneAsset) | |
533 | 472 | then (pmtId == amIdStr) | |
534 | 473 | else false) | |
535 | 474 | then $Tuple2(pmtAmt, 0) | |
536 | 475 | else if (if (isOneAsset) | |
537 | 476 | then (pmtId == prIdStr) | |
538 | 477 | else false) | |
539 | 478 | then $Tuple2(0, pmtAmt) | |
540 | 479 | else $Tuple2(calcAmAssetPmt, calcPrAssetPmt) | |
541 | - | let writeAmAmt = $ | |
542 | - | let writePrAmt = $ | |
480 | + | let writeAmAmt = $t02058820933._1 | |
481 | + | let writePrAmt = $t02058820933._2 | |
543 | 482 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId58), dataPutActionInfo(writeAmAmt, writePrAmt, emitLpAmt, curPrice, slippage, slippageCalc, height, lastBlock.timestamp, amDiff, prDiff))] | |
544 | 483 | $Tuple13(calcLpAmt, emitLpAmt, curPrice, amBalance, prBalance, lpEm, lpId, sts, commonState, amDiff, prDiff, inAmId, inPrId) | |
545 | 484 | } | |
546 | 485 | } | |
547 | 486 | ||
548 | 487 | ||
549 | 488 | func getYD (xp,i,D) = { | |
550 | 489 | let n = big2 | |
551 | 490 | let x = xp[if ((i == 0)) | |
552 | 491 | then 1 | |
553 | 492 | else 0] | |
554 | 493 | let aPrecision = parseBigIntValue(Amult) | |
555 | 494 | let a = (parseBigIntValue(A) * aPrecision) | |
556 | 495 | let s = x | |
557 | 496 | let ann = (a * n) | |
558 | 497 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
559 | 498 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
560 | 499 | func calc (acc,cur) = { | |
561 | - | let $ | |
562 | - | let y = $ | |
563 | - | let found = $ | |
500 | + | let $t02212822148 = acc | |
501 | + | let y = $t02212822148._1 | |
502 | + | let found = $t02212822148._2 | |
564 | 503 | if ((found != unit)) | |
565 | 504 | then acc | |
566 | 505 | else { | |
567 | 506 | let yNext = (((y * y) + c) / ((big2 * y) + b)) | |
568 | 507 | let yDiff = absBigInt((yNext - value(y))) | |
569 | 508 | if ((big1 >= yDiff)) | |
570 | 509 | then $Tuple2(yNext, cur) | |
571 | 510 | else $Tuple2(yNext, unit) | |
572 | 511 | } | |
573 | 512 | } | |
574 | 513 | ||
575 | 514 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
576 | - | let $ | |
515 | + | let $t02245522502 = { | |
577 | 516 | let $l = arr | |
578 | 517 | let $s = size($l) | |
579 | 518 | let $acc0 = $Tuple2(D, unit) | |
580 | 519 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
581 | 520 | then $a | |
582 | 521 | else calc($a, $l[$i]) | |
583 | 522 | ||
584 | 523 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
585 | 524 | then $a | |
586 | 525 | else throw("List size exceeds 15") | |
587 | 526 | ||
588 | 527 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
589 | 528 | } | |
590 | - | let y = $ | |
591 | - | let found = $ | |
529 | + | let y = $t02245522502._1 | |
530 | + | let found = $t02245522502._2 | |
592 | 531 | if ((found != unit)) | |
593 | 532 | then y | |
594 | 533 | else throw(("Y calculation error, Y = " + toString(y))) | |
595 | 534 | } | |
596 | 535 | ||
597 | 536 | ||
598 | 537 | func calcDLp (amountBalance,priceBalance,lpEmission) = { | |
599 | 538 | let updatedDLp = fraction(getD([t1BigInt(amountBalance, toBigInt(cfgAmountAssetDecimals)), t1BigInt(priceBalance, toBigInt(cfgPriceAssetDecimals))]), scale18, lpEmission) | |
600 | 539 | if ((lpEmission == big0)) | |
601 | 540 | then big0 | |
602 | 541 | else updatedDLp | |
603 | 542 | } | |
604 | 543 | ||
605 | 544 | ||
606 | 545 | func calcCurrentDLp (amountAssetDelta,priceAssetDelta,lpAssetEmissionDelta) = { | |
607 | 546 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amountAssetDelta) | |
608 | 547 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - priceAssetDelta) | |
609 | 548 | let lpAssetEmission = (toBigInt(value(assetInfo(cfgLpAssetId)).quantity) - lpAssetEmissionDelta) | |
610 | 549 | let currentDLp = calcDLp(amountAssetBalance, priceAssetBalance, lpAssetEmission) | |
611 | 550 | currentDLp | |
612 | 551 | } | |
613 | 552 | ||
614 | 553 | ||
615 | 554 | func refreshDLpInternal (amountAssetBalanceDelta,priceAssetBalanceDelta,lpAssetEmissionDelta) = { | |
616 | 555 | let amountAssetBalance = (getAccBalance(assetIdToString(cfgAmountAssetId)) + amountAssetBalanceDelta) | |
617 | 556 | let priceAssetBalance = (getAccBalance(assetIdToString(cfgPriceAssetId)) + priceAssetBalanceDelta) | |
618 | 557 | let lpAssetEmission = (value(assetInfo(cfgLpAssetId)).quantity + lpAssetEmissionDelta) | |
619 | 558 | let updatedDLp = calcDLp(toBigInt(amountAssetBalance), toBigInt(priceAssetBalance), toBigInt(lpAssetEmission)) | |
620 | 559 | let actions = [IntegerEntry(keyDLpRefreshedHeight, height), StringEntry(keyDLp, toString(updatedDLp))] | |
621 | 560 | $Tuple2(actions, updatedDLp) | |
622 | 561 | } | |
623 | 562 | ||
624 | 563 | ||
625 | 564 | func validateUpdatedDLp (oldDLp,updatedDLp) = if ((updatedDLp >= oldDLp)) | |
626 | 565 | then true | |
627 | 566 | else throwErr("updated DLp lower than current DLp") | |
628 | 567 | ||
629 | 568 | ||
630 | 569 | func validateMatcherOrderAllowed (order) = { | |
631 | 570 | let amountAssetBalance = getAccBalance(assetIdToString(cfgAmountAssetId)) | |
632 | 571 | let priceAssetBalance = getAccBalance(assetIdToString(cfgPriceAssetId)) | |
633 | 572 | let amountAssetAmount = order.amount | |
634 | 573 | let priceAssetAmount = fraction(order.amount, order.price, scale8, FLOOR) | |
635 | - | let $ | |
574 | + | let $t02470024912 = if ((order.orderType == Buy)) | |
636 | 575 | then $Tuple2(amountAssetAmount, -(priceAssetAmount)) | |
637 | 576 | else $Tuple2(-(amountAssetAmount), priceAssetAmount) | |
638 | - | let amountAssetBalanceDelta = $ | |
639 | - | let priceAssetBalanceDelta = $ | |
577 | + | let amountAssetBalanceDelta = $t02470024912._1 | |
578 | + | let priceAssetBalanceDelta = $t02470024912._2 | |
640 | 579 | if (if (if (igs()) | |
641 | 580 | then true | |
642 | 581 | else (cfgPoolStatus == PoolMatcherDis)) | |
643 | 582 | then true | |
644 | 583 | else (cfgPoolStatus == PoolShutdown)) | |
645 | 584 | then throw("Admin blocked") | |
646 | 585 | else if (if ((order.assetPair.amountAsset != cfgAmountAssetId)) | |
647 | 586 | then true | |
648 | 587 | else (order.assetPair.priceAsset != cfgPriceAssetId)) | |
649 | 588 | then throw("Wr assets") | |
650 | 589 | else { | |
651 | 590 | let dLp = parseBigIntValue(valueOrElse(getString(this, keyDLp), "0")) | |
652 | - | let $ | |
653 | - | let unusedActions = $ | |
654 | - | let dLpNew = $ | |
591 | + | let $t02525425354 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
592 | + | let unusedActions = $t02525425354._1 | |
593 | + | let dLpNew = $t02525425354._2 | |
655 | 594 | let isOrderValid = (dLpNew >= dLp) | |
656 | 595 | let info = makeString(["dLp=", toString(dLp), " dLpNew=", toString(dLpNew), " amountAssetBalance=", toString(amountAssetBalance), " priceAssetBalance=", toString(priceAssetBalance), " amountAssetBalanceDelta=", toString(amountAssetBalanceDelta), " priceAssetBalanceDelta=", toString(priceAssetBalanceDelta), " height=", toString(height)], "") | |
657 | 596 | $Tuple2(isOrderValid, info) | |
658 | 597 | } | |
659 | 598 | } | |
660 | 599 | ||
661 | 600 | ||
662 | 601 | func cg (i) = if ((size(i.payments) != 1)) | |
663 | 602 | then throw("1 pmnt exp") | |
664 | 603 | else { | |
665 | 604 | let pmt = value(i.payments[0]) | |
666 | 605 | let pmtAssetId = value(pmt.assetId) | |
667 | 606 | let pmtAmt = pmt.amount | |
668 | 607 | let r = ego(toBase58String(i.transactionId), toBase58String(pmtAssetId), pmtAmt, i.caller) | |
669 | 608 | let outAmAmt = r._1 | |
670 | 609 | let outPrAmt = r._2 | |
671 | 610 | let sts = parseIntValue(r._9) | |
672 | 611 | let state = r._10 | |
673 | 612 | if (if (igs()) | |
674 | 613 | then true | |
675 | 614 | else (sts == PoolShutdown)) | |
676 | 615 | then throw(("Admin blocked: " + toString(sts))) | |
677 | 616 | else $Tuple5(outAmAmt, outPrAmt, pmtAmt, pmtAssetId, state) | |
678 | 617 | } | |
679 | 618 | ||
680 | 619 | ||
681 | 620 | func cp (caller,txId,amAsPmt,prAsPmt,slippage,emitLp,isOneAsset,validateSlippage,pmtAmt,pmtId) = { | |
682 | 621 | let r = epo(txId, slippage, value(amAsPmt).amount, value(amAsPmt).assetId, value(prAsPmt).amount, value(prAsPmt).assetId, caller, (txId == ""), emitLp, isOneAsset, validateSlippage, pmtAmt, pmtId) | |
683 | 622 | let sts = parseIntValue(r._8) | |
684 | 623 | if (if (if (igs()) | |
685 | 624 | then true | |
686 | 625 | else (sts == PoolPutDis)) | |
687 | 626 | then true | |
688 | 627 | else (sts == PoolShutdown)) | |
689 | 628 | then throw(("Blocked:" + toString(sts))) | |
690 | 629 | else r | |
691 | 630 | } | |
692 | 631 | ||
693 | 632 | ||
694 | 633 | func calcPutOneTkn (pmtAmtRaw,pmtAssetId,userAddress,txId,withTakeFee) = { | |
695 | 634 | let amId = toBase58String(value(cfgAmountAssetId)) | |
696 | 635 | let prId = toBase58String(value(cfgPriceAssetId)) | |
697 | 636 | let lpId = cfgLpAssetId | |
698 | 637 | let amtDcm = cfgAmountAssetDecimals | |
699 | 638 | let priceDcm = cfgPriceAssetDecimals | |
700 | 639 | let lpAssetEmission = toBigInt(valueOrErrorMessage(assetInfo(lpId), "invalid lp asset").quantity) | |
701 | 640 | let chechEmission = if ((lpAssetEmission > big0)) | |
702 | 641 | then true | |
703 | 642 | else throw("initial deposit requires all coins") | |
704 | 643 | if ((chechEmission == chechEmission)) | |
705 | 644 | then { | |
706 | 645 | let amBalance = getAccBalance(amId) | |
707 | 646 | let prBalance = getAccBalance(prId) | |
708 | - | let $ | |
647 | + | let $t02801028472 = if ((txId == "")) | |
709 | 648 | then $Tuple2(amBalance, prBalance) | |
710 | 649 | else if ((pmtAssetId == amId)) | |
711 | 650 | then if ((pmtAmtRaw > amBalance)) | |
712 | 651 | then throw("invalid payment amount") | |
713 | 652 | else $Tuple2((amBalance - pmtAmtRaw), prBalance) | |
714 | 653 | else if ((pmtAssetId == prId)) | |
715 | 654 | then if ((pmtAmtRaw > prBalance)) | |
716 | 655 | then throw("invalid payment amount") | |
717 | 656 | else $Tuple2(amBalance, (prBalance - pmtAmtRaw)) | |
718 | 657 | else throw("wrong pmtAssetId") | |
719 | - | let amBalanceOld = $ | |
720 | - | let prBalanceOld = $ | |
721 | - | let $ | |
658 | + | let amBalanceOld = $t02801028472._1 | |
659 | + | let prBalanceOld = $t02801028472._2 | |
660 | + | let $t02847828654 = if ((pmtAssetId == amId)) | |
722 | 661 | then $Tuple2(pmtAmtRaw, 0) | |
723 | 662 | else if ((pmtAssetId == prId)) | |
724 | 663 | then $Tuple2(0, pmtAmtRaw) | |
725 | 664 | else throw("invalid payment") | |
726 | - | let amAmountRaw = $ | |
727 | - | let prAmountRaw = $ | |
728 | - | let $ | |
665 | + | let amAmountRaw = $t02847828654._1 | |
666 | + | let prAmountRaw = $t02847828654._2 | |
667 | + | let $t02865828912 = if (withTakeFee) | |
729 | 668 | then $Tuple3(takeFee(amAmountRaw, inFee)._1, takeFee(prAmountRaw, inFee)._1, takeFee(pmtAmtRaw, inFee)._2) | |
730 | 669 | else $Tuple3(amAmountRaw, prAmountRaw, 0) | |
731 | - | let amAmount = $ | |
732 | - | let prAmount = $ | |
733 | - | let feeAmount = $ | |
670 | + | let amAmount = $t02865828912._1 | |
671 | + | let prAmount = $t02865828912._2 | |
672 | + | let feeAmount = $t02865828912._3 | |
734 | 673 | let amBalanceNew = (amBalanceOld + amAmount) | |
735 | 674 | let prBalanceNew = (prBalanceOld + prAmount) | |
736 | 675 | let D0 = getD([t1(amBalanceOld, cfgAmountAssetDecimals), t1(prBalanceOld, cfgPriceAssetDecimals)]) | |
737 | 676 | let D1 = getD([t1(amBalanceNew, cfgAmountAssetDecimals), t1(prBalanceNew, cfgPriceAssetDecimals)]) | |
738 | 677 | let checkD = if ((D1 > D0)) | |
739 | 678 | then true | |
740 | 679 | else throw() | |
741 | 680 | if ((checkD == checkD)) | |
742 | 681 | then { | |
743 | 682 | let lpAmount = fraction(lpAssetEmission, (D1 - D0), D0, FLOOR) | |
744 | 683 | let curPrice = f1(cpbi(t1(prBalanceNew, priceDcm), t1(amBalanceNew, amtDcm)), scale8) | |
745 | 684 | let commonState = [IntegerEntry(pl(), curPrice), IntegerEntry(ph(height, lastBlock.timestamp), curPrice), StringEntry(pau(userAddress, txId), dataPutActionInfo(amAmountRaw, prAmountRaw, toInt(lpAmount), curPrice, 0, 0, height, lastBlock.timestamp, 0, 0))] | |
746 | 685 | let poolProportion = fraction(prBalanceOld, scale8, amBalanceOld) | |
747 | 686 | let amountAssetPart = fraction(pmtAmtRaw, scale8, (poolProportion + scale8)) | |
748 | 687 | let priceAssetPart = (pmtAmtRaw - amountAssetPart) | |
749 | 688 | let lpAmtBoth = fraction(lpAssetEmission, toBigInt(priceAssetPart), toBigInt(prBalanceOld)) | |
750 | 689 | let bonus = toInt(fraction((lpAmount - lpAmtBoth), scale8BigInt, lpAmtBoth)) | |
751 | 690 | $Tuple4(toInt(lpAmount), commonState, feeAmount, bonus) | |
752 | 691 | } | |
753 | 692 | else throw("Strict value is not equal to itself.") | |
754 | 693 | } | |
755 | 694 | else throw("Strict value is not equal to itself.") | |
756 | 695 | } | |
757 | 696 | ||
758 | 697 | ||
759 | 698 | func getOneTknV2Internal (outAssetId,minOutAmount,payments,caller,originCaller,transactionId) = { | |
760 | 699 | let lpId = toBase58String(value(cfgLpAssetId)) | |
761 | 700 | let amId = toBase58String(value(cfgAmountAssetId)) | |
762 | 701 | let prId = toBase58String(value(cfgPriceAssetId)) | |
763 | 702 | let amDecimals = cfgAmountAssetDecimals | |
764 | 703 | let prDecimals = cfgPriceAssetDecimals | |
765 | 704 | let poolStatus = cfgPoolStatus | |
766 | 705 | let userAddress = if ((caller == restContract)) | |
767 | 706 | then originCaller | |
768 | 707 | else caller | |
769 | 708 | let pmt = value(payments[0]) | |
770 | 709 | let pmtAssetId = value(pmt.assetId) | |
771 | 710 | let pmtAmt = pmt.amount | |
772 | 711 | let currentDLp = calcCurrentDLp(big0, big0, big0) | |
773 | 712 | if ((currentDLp == currentDLp)) | |
774 | 713 | then { | |
775 | 714 | let txId58 = toBase58String(transactionId) | |
776 | 715 | if ((lpId != toBase58String(pmtAssetId))) | |
777 | 716 | then throw("Wrong LP") | |
778 | 717 | else { | |
779 | 718 | let amBalance = getAccBalance(amId) | |
780 | 719 | let prBalance = getAccBalance(prId) | |
781 | - | let $ | |
720 | + | let $t03102431135 = { | |
782 | 721 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, pmtAmt], nil) | |
783 | 722 | if ($isInstanceOf(@, "(Int, Int)")) | |
784 | 723 | then @ | |
785 | 724 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
786 | 725 | } | |
787 | - | if (($ | |
726 | + | if (($t03102431135 == $t03102431135)) | |
788 | 727 | then { | |
789 | - | let feeAmount = $ | |
790 | - | let totalGet = $ | |
728 | + | let feeAmount = $t03102431135._2 | |
729 | + | let totalGet = $t03102431135._1 | |
791 | 730 | let totalAmount = if (if ((minOutAmount > 0)) | |
792 | 731 | then (minOutAmount > totalGet) | |
793 | 732 | else false) | |
794 | 733 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
795 | 734 | else totalGet | |
796 | - | let $ | |
735 | + | let $t03132531632 = if ((outAssetId == amId)) | |
797 | 736 | then $Tuple4(totalAmount, 0, ((amBalance - totalAmount) - feeAmount), prBalance) | |
798 | 737 | else if ((outAssetId == prId)) | |
799 | 738 | then $Tuple4(0, totalAmount, amBalance, ((prBalance - totalAmount) - feeAmount)) | |
800 | 739 | else throw("invalid out asset id") | |
801 | - | let outAm = $ | |
802 | - | let outPr = $ | |
803 | - | let amBalanceNew = $ | |
804 | - | let prBalanceNew = $ | |
740 | + | let outAm = $t03132531632._1 | |
741 | + | let outPr = $t03132531632._2 | |
742 | + | let amBalanceNew = $t03132531632._3 | |
743 | + | let prBalanceNew = $t03132531632._4 | |
805 | 744 | let curPrX18 = cpbi(t1(prBalanceNew, prDecimals), t1(amBalanceNew, amDecimals)) | |
806 | 745 | let curPr = f1(curPrX18, scale8) | |
807 | 746 | let outAssetIdOrWaves = if ((outAssetId == "WAVES")) | |
808 | 747 | then unit | |
809 | 748 | else fromBase58String(outAssetId) | |
810 | 749 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
811 | 750 | then [ScriptTransfer(feeCollectorAddress, feeAmount, outAssetIdOrWaves)] | |
812 | 751 | else nil | |
813 | 752 | let state = ([ScriptTransfer(userAddress, totalAmount, outAssetIdOrWaves), StringEntry(gau(toString(userAddress), txId58), dataGetActionInfo(outAm, outPr, pmtAmt, curPr, height, lastBlock.timestamp)), IntegerEntry(pl(), curPr), IntegerEntry(ph(height, lastBlock.timestamp), curPr)] ++ sendFeeToMatcher) | |
814 | 753 | if ((state == state)) | |
815 | 754 | then { | |
816 | 755 | let burn = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
817 | 756 | if ((burn == burn)) | |
818 | 757 | then { | |
819 | - | let $ | |
758 | + | let $t03241732767 = { | |
820 | 759 | let feeAmountForCalc = if ((this == feeCollectorAddress)) | |
821 | 760 | then 0 | |
822 | 761 | else feeAmount | |
823 | 762 | let outInAmountAsset = if ((parseAssetId(outAssetId) == cfgAmountAssetId)) | |
824 | 763 | then true | |
825 | 764 | else false | |
826 | 765 | if (outInAmountAsset) | |
827 | 766 | then $Tuple2(-((totalGet + feeAmountForCalc)), 0) | |
828 | 767 | else $Tuple2(0, -((totalGet + feeAmountForCalc))) | |
829 | 768 | } | |
830 | - | let amountAssetBalanceDelta = $ | |
831 | - | let priceAssetBalanceDelta = $ | |
832 | - | let $ | |
833 | - | let refreshDLpActions = $ | |
834 | - | let updatedDLp = $ | |
769 | + | let amountAssetBalanceDelta = $t03241732767._1 | |
770 | + | let priceAssetBalanceDelta = $t03241732767._2 | |
771 | + | let $t03277032878 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
772 | + | let refreshDLpActions = $t03277032878._1 | |
773 | + | let updatedDLp = $t03277032878._2 | |
835 | 774 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
836 | 775 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
837 | 776 | then $Tuple2((state ++ refreshDLpActions), totalAmount) | |
838 | 777 | else throw("Strict value is not equal to itself.") | |
839 | 778 | } | |
840 | 779 | else throw("Strict value is not equal to itself.") | |
841 | 780 | } | |
842 | 781 | else throw("Strict value is not equal to itself.") | |
843 | 782 | } | |
844 | 783 | else throw("Strict value is not equal to itself.") | |
845 | 784 | } | |
846 | 785 | } | |
847 | 786 | else throw("Strict value is not equal to itself.") | |
848 | 787 | } | |
849 | 788 | ||
850 | 789 | ||
851 | 790 | func m () = match getString(mpk()) { | |
852 | 791 | case s: String => | |
853 | 792 | fromBase58String(s) | |
854 | 793 | case _: Unit => | |
855 | 794 | unit | |
856 | 795 | case _ => | |
857 | 796 | throw("Match error") | |
858 | 797 | } | |
859 | 798 | ||
860 | 799 | ||
861 | 800 | func pm () = match getString(pmpk()) { | |
862 | 801 | case s: String => | |
863 | 802 | fromBase58String(s) | |
864 | 803 | case _: Unit => | |
865 | 804 | unit | |
866 | 805 | case _ => | |
867 | 806 | throw("Match error") | |
868 | 807 | } | |
869 | 808 | ||
870 | 809 | ||
871 | 810 | let pd = throw("Permission denied") | |
872 | 811 | ||
873 | 812 | func isManager (i) = match m() { | |
874 | 813 | case pk: ByteVector => | |
875 | 814 | (i.callerPublicKey == pk) | |
876 | 815 | case _: Unit => | |
877 | 816 | (i.caller == this) | |
878 | 817 | case _ => | |
879 | 818 | throw("Match error") | |
880 | 819 | } | |
881 | 820 | ||
882 | 821 | ||
883 | 822 | func mm (i) = match m() { | |
884 | 823 | case pk: ByteVector => | |
885 | 824 | if ((i.callerPublicKey == pk)) | |
886 | 825 | then true | |
887 | 826 | else pd | |
888 | 827 | case _: Unit => | |
889 | 828 | if ((i.caller == this)) | |
890 | 829 | then true | |
891 | 830 | else pd | |
892 | 831 | case _ => | |
893 | 832 | throw("Match error") | |
894 | 833 | } | |
895 | 834 | ||
896 | 835 | ||
897 | 836 | func getY (isReverse,D,poolAmountInBalance) = { | |
898 | 837 | let poolConfig = gpc() | |
899 | 838 | let amId = poolConfig[idxAmAsId] | |
900 | 839 | let prId = poolConfig[idxPrAsId] | |
901 | 840 | let n = big2 | |
902 | 841 | let aPrecision = parseBigIntValue(Amult) | |
903 | 842 | let a = (parseBigIntValue(A) * aPrecision) | |
904 | 843 | let xp = if ((isReverse == false)) | |
905 | 844 | then [(toBigInt(getAccBalance(amId)) + poolAmountInBalance), toBigInt(getAccBalance(prId))] | |
906 | 845 | else [(toBigInt(getAccBalance(prId)) + poolAmountInBalance), toBigInt(getAccBalance(amId))] | |
907 | 846 | let x = xp[0] | |
908 | 847 | let s = x | |
909 | 848 | let ann = (a * n) | |
910 | 849 | let c = (((((D * D) / (x * n)) * D) * aPrecision) / (ann * n)) | |
911 | 850 | let b = ((s + ((D * aPrecision) / ann)) - D) | |
912 | 851 | func calc (acc,cur) = { | |
913 | - | let $ | |
914 | - | let y = $ | |
915 | - | let found = $ | |
852 | + | let $t03432534345 = acc | |
853 | + | let y = $t03432534345._1 | |
854 | + | let found = $t03432534345._2 | |
916 | 855 | if ((found != unit)) | |
917 | 856 | then acc | |
918 | 857 | else { | |
919 | 858 | let yNext = (((y * y) + c) / ((big2 * y) + b)) | |
920 | 859 | let yDiff = absBigInt((yNext - value(y))) | |
921 | 860 | if ((big1 >= yDiff)) | |
922 | 861 | then $Tuple2(yNext, cur) | |
923 | 862 | else $Tuple2(yNext, unit) | |
924 | 863 | } | |
925 | 864 | } | |
926 | 865 | ||
927 | 866 | let arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
928 | - | let $ | |
867 | + | let $t03467634723 = { | |
929 | 868 | let $l = arr | |
930 | 869 | let $s = size($l) | |
931 | 870 | let $acc0 = $Tuple2(D, unit) | |
932 | 871 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
933 | 872 | then $a | |
934 | 873 | else calc($a, $l[$i]) | |
935 | 874 | ||
936 | 875 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
937 | 876 | then $a | |
938 | 877 | else throw("List size exceeds 15") | |
939 | 878 | ||
940 | 879 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
941 | 880 | } | |
942 | - | let y = $ | |
943 | - | let found = $ | |
881 | + | let y = $t03467634723._1 | |
882 | + | let found = $t03467634723._2 | |
944 | 883 | if ((found != unit)) | |
945 | 884 | then y | |
946 | 885 | else throw(("Y calculation error, Y = " + toString(y))) | |
947 | 886 | } | |
948 | 887 | ||
949 | 888 | ||
950 | 889 | func skipOrderValidation () = valueOrElse(getBoolean(fca, keySkipOrderValidation(toString(this))), false) | |
951 | 890 | ||
952 | 891 | ||
953 | 892 | @Callable(i) | |
954 | 893 | func calculateAmountOutForSwapREADONLY (cleanAmountIn,isReverse,feePoolAmount) = { | |
955 | - | let $ | |
894 | + | let $t03507535499 = if ((isReverse == false)) | |
956 | 895 | then { | |
957 | 896 | let assetOut = strf(this, pa()) | |
958 | 897 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, aa()))) + toBigInt(cleanAmountIn)) | |
959 | 898 | $Tuple2(assetOut, poolAmountInBalance) | |
960 | 899 | } | |
961 | 900 | else { | |
962 | 901 | let assetOut = strf(this, aa()) | |
963 | 902 | let poolAmountInBalance = (toBigInt(getAccBalance(strf(this, pa()))) + toBigInt(cleanAmountIn)) | |
964 | 903 | $Tuple2(assetOut, poolAmountInBalance) | |
965 | 904 | } | |
966 | - | let assetOut = $ | |
967 | - | let poolAmountInBalance = $ | |
905 | + | let assetOut = $t03507535499._1 | |
906 | + | let poolAmountInBalance = $t03507535499._2 | |
968 | 907 | let poolConfig = gpc() | |
969 | 908 | let amId = poolConfig[idxAmAsId] | |
970 | 909 | let prId = poolConfig[idxPrAsId] | |
971 | 910 | let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))] | |
972 | 911 | let D = getD(xp) | |
973 | 912 | let y = getY(isReverse, D, toBigInt(cleanAmountIn)) | |
974 | 913 | let dy = ((toBigInt(getAccBalance(assetOut)) - y) - toBigInt(1)) | |
975 | 914 | let totalGetRaw = max([0, toInt(dy)]) | |
976 | 915 | let newXp = if ((isReverse == false)) | |
977 | 916 | then [((toBigInt(getAccBalance(amId)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount)), (toBigInt(getAccBalance(prId)) - dy)] | |
978 | 917 | else [(toBigInt(getAccBalance(amId)) - dy), ((toBigInt(getAccBalance(prId)) + toBigInt(cleanAmountIn)) + toBigInt(feePoolAmount))] | |
979 | 918 | let newD = getD(newXp) | |
980 | 919 | let checkD = if ((newD >= D)) | |
981 | 920 | then true | |
982 | 921 | else throw(makeString(["new D is fewer error", toString(D), toString(newD)], "__")) | |
983 | 922 | if ((checkD == checkD)) | |
984 | 923 | then $Tuple2(nil, totalGetRaw) | |
985 | 924 | else throw("Strict value is not equal to itself.") | |
986 | 925 | } | |
987 | 926 | ||
988 | 927 | ||
989 | 928 | ||
990 | 929 | @Callable(i) | |
991 | 930 | func calculateAmountOutForSwapAndSendTokens (cleanAmountIn,isReverse,amountOutMin,addressTo,feePoolAmount) = { | |
992 | 931 | let swapContact = { | |
993 | 932 | let @ = invoke(fca, "getSwapContractREADONLY", nil, nil) | |
994 | 933 | if ($isInstanceOf(@, "String")) | |
995 | 934 | then @ | |
996 | 935 | else throw(($getType(@) + " couldn't be cast to String")) | |
997 | 936 | } | |
998 | 937 | let checks = [if ((value(i.payments[0]).amount >= cleanAmountIn)) | |
999 | 938 | then true | |
1000 | 939 | else throwErr("Wrong amount"), if ((i.caller == addressFromStringValue(swapContact))) | |
1001 | 940 | then true | |
1002 | 941 | else throwErr("Permission denied")] | |
1003 | 942 | if ((checks == checks)) | |
1004 | 943 | then { | |
1005 | 944 | let pmt = value(i.payments[0]) | |
1006 | 945 | let assetIn = assetIdToString(pmt.assetId) | |
1007 | - | let $ | |
946 | + | let $t03693537329 = if ((isReverse == false)) | |
1008 | 947 | then { | |
1009 | 948 | let assetOut = strf(this, pa()) | |
1010 | 949 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1011 | 950 | $Tuple2(assetOut, poolAmountInBalance) | |
1012 | 951 | } | |
1013 | 952 | else { | |
1014 | 953 | let assetOut = strf(this, aa()) | |
1015 | 954 | let poolAmountInBalance = (getAccBalance(assetIn) - value(i.payments[0]).amount) | |
1016 | 955 | $Tuple2(assetOut, poolAmountInBalance) | |
1017 | 956 | } | |
1018 | - | let assetOut = $ | |
1019 | - | let poolAmountInBalance = $ | |
957 | + | let assetOut = $t03693537329._1 | |
958 | + | let poolAmountInBalance = $t03693537329._2 | |
1020 | 959 | let poolConfig = gpc() | |
1021 | 960 | let amId = poolConfig[idxAmAsId] | |
1022 | 961 | let prId = poolConfig[idxPrAsId] | |
1023 | 962 | let xp = if ((isReverse == false)) | |
1024 | 963 | then [(toBigInt(getAccBalance(amId)) - toBigInt(value(i.payments[0]).amount)), toBigInt(getAccBalance(prId))] | |
1025 | 964 | else [toBigInt(getAccBalance(amId)), (toBigInt(getAccBalance(prId)) - toBigInt(value(i.payments[0]).amount))] | |
1026 | 965 | let D = getD(xp) | |
1027 | 966 | let y = getY(isReverse, D, toBigInt(0)) | |
1028 | 967 | let dy = ((toBigInt(getAccBalance(assetOut)) - y) - toBigInt(1)) | |
1029 | 968 | let totalGetRaw = max([0, toInt(dy)]) | |
1030 | 969 | let checkMin = if ((totalGetRaw >= amountOutMin)) | |
1031 | 970 | then true | |
1032 | 971 | else throw("Exchange result is fewer coins than expected") | |
1033 | 972 | if ((checkMin == checkMin)) | |
1034 | 973 | then { | |
1035 | 974 | let newXp = if ((isReverse == false)) | |
1036 | 975 | then [(toBigInt(getAccBalance(amId)) + toBigInt(feePoolAmount)), (toBigInt(getAccBalance(prId)) - dy)] | |
1037 | 976 | else [(toBigInt(getAccBalance(amId)) - dy), (toBigInt(getAccBalance(prId)) + toBigInt(feePoolAmount))] | |
1038 | 977 | let newD = getD(newXp) | |
1039 | 978 | let checkD = if ((newD >= D)) | |
1040 | 979 | then true | |
1041 | 980 | else throw("new D is fewer error") | |
1042 | 981 | if ((checkD == checkD)) | |
1043 | 982 | then $Tuple2([ScriptTransfer(addressFromStringValue(addressTo), totalGetRaw, parseAssetId(assetOut))], totalGetRaw) | |
1044 | 983 | else throw("Strict value is not equal to itself.") | |
1045 | 984 | } | |
1046 | 985 | else throw("Strict value is not equal to itself.") | |
1047 | 986 | } | |
1048 | 987 | else throw("Strict value is not equal to itself.") | |
1049 | 988 | } | |
1050 | 989 | ||
1051 | 990 | ||
1052 | 991 | ||
1053 | 992 | @Callable(i) | |
1054 | 993 | func constructor (fc) = { | |
1055 | 994 | let c = mm(i) | |
1056 | 995 | if ((c == c)) | |
1057 | 996 | then [StringEntry(fc(), fc)] | |
1058 | 997 | else throw("Strict value is not equal to itself.") | |
1059 | 998 | } | |
1060 | 999 | ||
1061 | 1000 | ||
1062 | 1001 | ||
1063 | 1002 | @Callable(i) | |
1064 | 1003 | func setManager (pendingManagerPublicKey) = { | |
1065 | 1004 | let c = mm(i) | |
1066 | 1005 | if ((c == c)) | |
1067 | 1006 | then { | |
1068 | 1007 | let cm = fromBase58String(pendingManagerPublicKey) | |
1069 | 1008 | if ((cm == cm)) | |
1070 | 1009 | then [StringEntry(pmpk(), pendingManagerPublicKey)] | |
1071 | 1010 | else throw("Strict value is not equal to itself.") | |
1072 | 1011 | } | |
1073 | 1012 | else throw("Strict value is not equal to itself.") | |
1074 | 1013 | } | |
1075 | 1014 | ||
1076 | 1015 | ||
1077 | 1016 | ||
1078 | 1017 | @Callable(i) | |
1079 | 1018 | func confirmManager () = { | |
1080 | 1019 | let p = pm() | |
1081 | 1020 | let hpm = if (isDefined(p)) | |
1082 | 1021 | then true | |
1083 | 1022 | else throw("No pending manager") | |
1084 | 1023 | if ((hpm == hpm)) | |
1085 | 1024 | then { | |
1086 | 1025 | let cpm = if ((i.callerPublicKey == value(p))) | |
1087 | 1026 | then true | |
1088 | 1027 | else throw("You are not pending manager") | |
1089 | 1028 | if ((cpm == cpm)) | |
1090 | 1029 | then [StringEntry(mpk(), toBase58String(value(p))), DeleteEntry(pmpk())] | |
1091 | 1030 | else throw("Strict value is not equal to itself.") | |
1092 | 1031 | } | |
1093 | 1032 | else throw("Strict value is not equal to itself.") | |
1094 | 1033 | } | |
1095 | 1034 | ||
1096 | 1035 | ||
1097 | 1036 | ||
1098 | 1037 | @Callable(i) | |
1099 | 1038 | func put (slip,autoStake) = { | |
1100 | 1039 | let factCfg = gfc() | |
1101 | 1040 | let stakingCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactStakCntr]), "Wr st addr") | |
1102 | 1041 | let slipCntr = valueOrErrorMessage(addressFromString(factCfg[idxFactSlippCntr]), "Wr sl addr") | |
1103 | 1042 | if ((0 > slip)) | |
1104 | 1043 | then throw("Wrong slippage") | |
1105 | 1044 | else if ((size(i.payments) != 2)) | |
1106 | 1045 | then throw("2 pmnts expd") | |
1107 | 1046 | else { | |
1108 | 1047 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1109 | 1048 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1110 | 1049 | let amountAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgAmountAssetId))) - amAssetPmt) | |
1111 | 1050 | if ((amountAssetBalance == amountAssetBalance)) | |
1112 | 1051 | then { | |
1113 | 1052 | let priceAssetBalance = (toBigInt(getAccBalance(assetIdToString(cfgPriceAssetId))) - prAssetPmt) | |
1114 | 1053 | if ((priceAssetBalance == priceAssetBalance)) | |
1115 | 1054 | then { | |
1116 | 1055 | let lpAssetEmission = toBigInt(value(assetInfo(cfgLpAssetId)).quantity) | |
1117 | 1056 | if ((lpAssetEmission == lpAssetEmission)) | |
1118 | 1057 | then { | |
1119 | 1058 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1120 | 1059 | if ((currentDLp == currentDLp)) | |
1121 | 1060 | then { | |
1122 | 1061 | let e = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], slip, true, false, true, 0, "") | |
1123 | 1062 | let emitLpAmt = e._2 | |
1124 | 1063 | let lpAssetId = e._7 | |
1125 | 1064 | let state = e._9 | |
1126 | 1065 | let amDiff = e._10 | |
1127 | 1066 | let prDiff = e._11 | |
1128 | 1067 | let amId = e._12 | |
1129 | 1068 | let prId = e._13 | |
1130 | 1069 | let r = invoke(fca, "emit", [emitLpAmt], nil) | |
1131 | 1070 | if ((r == r)) | |
1132 | 1071 | then { | |
1133 | 1072 | let el = match r { | |
1134 | 1073 | case legacy: Address => | |
1135 | 1074 | invoke(legacy, "emit", [emitLpAmt], nil) | |
1136 | 1075 | case _ => | |
1137 | 1076 | unit | |
1138 | 1077 | } | |
1139 | 1078 | if ((el == el)) | |
1140 | 1079 | then { | |
1141 | 1080 | let sa = if ((amDiff > 0)) | |
1142 | 1081 | then invoke(slipCntr, "put", nil, [AttachedPayment(amId, amDiff)]) | |
1143 | 1082 | else nil | |
1144 | 1083 | if ((sa == sa)) | |
1145 | 1084 | then { | |
1146 | 1085 | let sp = if ((prDiff > 0)) | |
1147 | 1086 | then invoke(slipCntr, "put", nil, [AttachedPayment(prId, prDiff)]) | |
1148 | 1087 | else nil | |
1149 | 1088 | if ((sp == sp)) | |
1150 | 1089 | then { | |
1151 | 1090 | let lpTrnsfr = if (autoStake) | |
1152 | 1091 | then { | |
1153 | 1092 | let ss = invoke(stakingCntr, "stake", nil, [AttachedPayment(lpAssetId, emitLpAmt)]) | |
1154 | 1093 | if ((ss == ss)) | |
1155 | 1094 | then nil | |
1156 | 1095 | else throw("Strict value is not equal to itself.") | |
1157 | 1096 | } | |
1158 | 1097 | else [ScriptTransfer(i.caller, emitLpAmt, lpAssetId)] | |
1159 | - | let $ | |
1160 | - | let refreshDLpActions = $ | |
1161 | - | let updatedDLp = $ | |
1098 | + | let $t04194842090 = refreshDLpInternal(0, 0, 0) | |
1099 | + | let refreshDLpActions = $t04194842090._1 | |
1100 | + | let updatedDLp = $t04194842090._2 | |
1162 | 1101 | let check = if ((updatedDLp >= currentDLp)) | |
1163 | 1102 | then true | |
1164 | 1103 | else throwErr(makeString(["updated DLp lower than current DLp", toString(amountAssetBalance), toString(priceAssetBalance), toString(lpAssetEmission), toString(currentDLp), toString(updatedDLp), toString(amDiff), toString(prDiff)], " ")) | |
1165 | 1104 | if ((check == check)) | |
1166 | 1105 | then { | |
1167 | 1106 | let lpAssetEmissionAfter = value(assetInfo(cfgLpAssetId)).quantity | |
1168 | 1107 | if ((lpAssetEmissionAfter == lpAssetEmissionAfter)) | |
1169 | 1108 | then ((state ++ lpTrnsfr) ++ refreshDLpActions) | |
1170 | 1109 | else throw("Strict value is not equal to itself.") | |
1171 | 1110 | } | |
1172 | 1111 | else throw("Strict value is not equal to itself.") | |
1173 | 1112 | } | |
1174 | 1113 | else throw("Strict value is not equal to itself.") | |
1175 | 1114 | } | |
1176 | 1115 | else throw("Strict value is not equal to itself.") | |
1177 | 1116 | } | |
1178 | 1117 | else throw("Strict value is not equal to itself.") | |
1179 | 1118 | } | |
1180 | 1119 | else throw("Strict value is not equal to itself.") | |
1181 | 1120 | } | |
1182 | 1121 | else throw("Strict value is not equal to itself.") | |
1183 | 1122 | } | |
1184 | 1123 | else throw("Strict value is not equal to itself.") | |
1185 | 1124 | } | |
1186 | 1125 | else throw("Strict value is not equal to itself.") | |
1187 | 1126 | } | |
1188 | 1127 | else throw("Strict value is not equal to itself.") | |
1189 | 1128 | } | |
1190 | 1129 | } | |
1191 | 1130 | ||
1192 | 1131 | ||
1193 | 1132 | ||
1194 | 1133 | @Callable(i) | |
1195 | 1134 | func putOneTknV2 (minOutAmount,autoStake) = { | |
1196 | 1135 | let isPoolOneTokenOperationsDisabled = { | |
1197 | 1136 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1198 | 1137 | if ($isInstanceOf(@, "Boolean")) | |
1199 | 1138 | then @ | |
1200 | 1139 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1201 | 1140 | } | |
1202 | 1141 | let isPutDisabled = if (if (if (igs()) | |
1203 | 1142 | then true | |
1204 | 1143 | else (cfgPoolStatus == PoolPutDis)) | |
1205 | 1144 | then true | |
1206 | 1145 | else (cfgPoolStatus == PoolShutdown)) | |
1207 | 1146 | then true | |
1208 | 1147 | else isPoolOneTokenOperationsDisabled | |
1209 | 1148 | let checks = [if (if (!(isPutDisabled)) | |
1210 | 1149 | then true | |
1211 | 1150 | else isManager(i)) | |
1212 | 1151 | then true | |
1213 | 1152 | else throwErr("put operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1214 | 1153 | then true | |
1215 | 1154 | else throwErr("exactly 1 payment are expected")] | |
1216 | 1155 | if ((checks == checks)) | |
1217 | 1156 | then { | |
1218 | 1157 | let amId = toBase58String(value(cfgAmountAssetId)) | |
1219 | 1158 | let prId = toBase58String(value(cfgPriceAssetId)) | |
1220 | 1159 | let lpId = cfgLpAssetId | |
1221 | 1160 | let amDecimals = cfgAmountAssetDecimals | |
1222 | 1161 | let prDecimals = cfgPriceAssetDecimals | |
1223 | 1162 | let userAddress = if ((i.caller == this)) | |
1224 | 1163 | then i.originCaller | |
1225 | 1164 | else i.caller | |
1226 | 1165 | let pmt = value(i.payments[0]) | |
1227 | 1166 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
1228 | 1167 | let pmtAmt = pmt.amount | |
1229 | 1168 | let currentDLp = if ((pmt.assetId == cfgAmountAssetId)) | |
1230 | 1169 | then calcCurrentDLp(toBigInt(pmtAmt), toBigInt(0), toBigInt(0)) | |
1231 | 1170 | else calcCurrentDLp(toBigInt(0), toBigInt(pmtAmt), toBigInt(0)) | |
1232 | 1171 | if ((currentDLp == currentDLp)) | |
1233 | 1172 | then { | |
1234 | - | let $ | |
1235 | - | if (($ | |
1173 | + | let $t04373143889 = calcPutOneTkn(pmtAmt, pmtAssetId, toString(userAddress), toBase58String(i.transactionId), true) | |
1174 | + | if (($t04373143889 == $t04373143889)) | |
1236 | 1175 | then { | |
1237 | - | let feeAmount = $ | |
1238 | - | let state = $ | |
1239 | - | let estimLP = $ | |
1176 | + | let feeAmount = $t04373143889._3 | |
1177 | + | let state = $t04373143889._2 | |
1178 | + | let estimLP = $t04373143889._1 | |
1240 | 1179 | let emitLpAmt = if (if ((minOutAmount > 0)) | |
1241 | 1180 | then (minOutAmount > estimLP) | |
1242 | 1181 | else false) | |
1243 | 1182 | then throwErr(makeString(["amount to receive is less than ", toString(minOutAmount)], "")) | |
1244 | 1183 | else estimLP | |
1245 | 1184 | let e = invoke(fca, "emit", [emitLpAmt], nil) | |
1246 | 1185 | if ((e == e)) | |
1247 | 1186 | then { | |
1248 | 1187 | let el = match e { | |
1249 | 1188 | case legacy: Address => | |
1250 | 1189 | invoke(legacy, "emit", [emitLpAmt], nil) | |
1251 | 1190 | case _ => | |
1252 | 1191 | unit | |
1253 | 1192 | } | |
1254 | 1193 | if ((el == el)) | |
1255 | 1194 | then { | |
1256 | 1195 | let lpTrnsfr = if (autoStake) | |
1257 | 1196 | then { | |
1258 | 1197 | let ss = invoke(stakingContract, "stakeFor", [toString(i.caller)], [AttachedPayment(lpId, emitLpAmt)]) | |
1259 | 1198 | if ((ss == ss)) | |
1260 | 1199 | then nil | |
1261 | 1200 | else throw("Strict value is not equal to itself.") | |
1262 | 1201 | } | |
1263 | 1202 | else [ScriptTransfer(i.caller, emitLpAmt, lpId)] | |
1264 | 1203 | let sendFeeToMatcher = if ((feeAmount > 0)) | |
1265 | 1204 | then [ScriptTransfer(feeCollectorAddress, feeAmount, fromBase58String(pmtAssetId))] | |
1266 | 1205 | else nil | |
1267 | - | let $ | |
1206 | + | let $t04477445123 = if ((this == feeCollectorAddress)) | |
1268 | 1207 | then $Tuple2(0, 0) | |
1269 | 1208 | else { | |
1270 | 1209 | let paymentInAmountAsset = if ((pmt.assetId == cfgAmountAssetId)) | |
1271 | 1210 | then true | |
1272 | 1211 | else false | |
1273 | 1212 | if (paymentInAmountAsset) | |
1274 | 1213 | then $Tuple2(-(feeAmount), 0) | |
1275 | 1214 | else $Tuple2(0, -(feeAmount)) | |
1276 | 1215 | } | |
1277 | - | let amountAssetBalanceDelta = $ | |
1278 | - | let priceAssetBalanceDelta = $ | |
1279 | - | let $ | |
1280 | - | let refreshDLpActions = $ | |
1281 | - | let updatedDLp = $ | |
1216 | + | let amountAssetBalanceDelta = $t04477445123._1 | |
1217 | + | let priceAssetBalanceDelta = $t04477445123._2 | |
1218 | + | let $t04512645234 = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0) | |
1219 | + | let refreshDLpActions = $t04512645234._1 | |
1220 | + | let updatedDLp = $t04512645234._2 | |
1282 | 1221 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1283 | 1222 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1284 | 1223 | then $Tuple2((((state ++ lpTrnsfr) ++ sendFeeToMatcher) ++ refreshDLpActions), emitLpAmt) | |
1285 | 1224 | else throw("Strict value is not equal to itself.") | |
1286 | 1225 | } | |
1287 | 1226 | else throw("Strict value is not equal to itself.") | |
1288 | 1227 | } | |
1289 | 1228 | else throw("Strict value is not equal to itself.") | |
1290 | 1229 | } | |
1291 | 1230 | else throw("Strict value is not equal to itself.") | |
1292 | 1231 | } | |
1293 | 1232 | else throw("Strict value is not equal to itself.") | |
1294 | 1233 | } | |
1295 | 1234 | else throw("Strict value is not equal to itself.") | |
1296 | 1235 | } | |
1297 | 1236 | ||
1298 | 1237 | ||
1299 | 1238 | ||
1300 | 1239 | @Callable(i) | |
1301 | 1240 | func putForFree (maxSlpg) = if ((0 > maxSlpg)) | |
1302 | 1241 | then throw("Wrong slpg") | |
1303 | 1242 | else if ((size(i.payments) != 2)) | |
1304 | 1243 | then throw("2 pmnts expd") | |
1305 | 1244 | else { | |
1306 | 1245 | let estPut = cp(toString(i.caller), toBase58String(i.transactionId), AttachedPayment(value(i.payments[0]).assetId, value(i.payments[0]).amount), i.payments[1], maxSlpg, false, false, true, 0, "") | |
1307 | 1246 | let state = estPut._9 | |
1308 | 1247 | let amAssetPmt = toBigInt(value(i.payments[0]).amount) | |
1309 | 1248 | let prAssetPmt = toBigInt(value(i.payments[1]).amount) | |
1310 | 1249 | let currentDLp = calcCurrentDLp(amAssetPmt, prAssetPmt, toBigInt(0)) | |
1311 | 1250 | if ((currentDLp == currentDLp)) | |
1312 | 1251 | then { | |
1313 | - | let $ | |
1314 | - | let refreshDLpActions = $ | |
1315 | - | let updatedDLp = $ | |
1252 | + | let $t04626446329 = refreshDLpInternal(0, 0, 0) | |
1253 | + | let refreshDLpActions = $t04626446329._1 | |
1254 | + | let updatedDLp = $t04626446329._2 | |
1316 | 1255 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1317 | 1256 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1318 | 1257 | then (state ++ refreshDLpActions) | |
1319 | 1258 | else throw("Strict value is not equal to itself.") | |
1320 | 1259 | } | |
1321 | 1260 | else throw("Strict value is not equal to itself.") | |
1322 | 1261 | } | |
1323 | 1262 | ||
1324 | 1263 | ||
1325 | 1264 | ||
1326 | 1265 | @Callable(i) | |
1327 | 1266 | func get () = { | |
1328 | 1267 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1329 | 1268 | if ((currentDLp == currentDLp)) | |
1330 | 1269 | then { | |
1331 | 1270 | let r = cg(i) | |
1332 | 1271 | let outAmtAmt = r._1 | |
1333 | 1272 | let outPrAmt = r._2 | |
1334 | 1273 | let pmtAmt = r._3 | |
1335 | 1274 | let pmtAssetId = r._4 | |
1336 | 1275 | let state = r._5 | |
1337 | 1276 | let b = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1338 | 1277 | if ((b == b)) | |
1339 | 1278 | then { | |
1340 | - | let $ | |
1341 | - | let refreshDLpActions = $ | |
1342 | - | let updatedDLp = $ | |
1279 | + | let $t04750247584 = refreshDLpInternal(-(outAmtAmt), -(outPrAmt), 0) | |
1280 | + | let refreshDLpActions = $t04750247584._1 | |
1281 | + | let updatedDLp = $t04750247584._2 | |
1343 | 1282 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1344 | 1283 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1345 | 1284 | then (state ++ refreshDLpActions) | |
1346 | 1285 | else throw("Strict value is not equal to itself.") | |
1347 | 1286 | } | |
1348 | 1287 | else throw("Strict value is not equal to itself.") | |
1349 | 1288 | } | |
1350 | 1289 | else throw("Strict value is not equal to itself.") | |
1351 | 1290 | } | |
1352 | 1291 | ||
1353 | 1292 | ||
1354 | 1293 | ||
1355 | 1294 | @Callable(i) | |
1356 | 1295 | func getOneTknV2 (outAssetId,minOutAmount) = { | |
1357 | 1296 | let isPoolOneTokenOperationsDisabled = { | |
1358 | 1297 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1359 | 1298 | if ($isInstanceOf(@, "Boolean")) | |
1360 | 1299 | then @ | |
1361 | 1300 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1362 | 1301 | } | |
1363 | 1302 | let isGetDisabled = if (if (igs()) | |
1364 | 1303 | then true | |
1365 | 1304 | else (cfgPoolStatus == PoolShutdown)) | |
1366 | 1305 | then true | |
1367 | 1306 | else isPoolOneTokenOperationsDisabled | |
1368 | 1307 | let checks = [if (if (!(isGetDisabled)) | |
1369 | 1308 | then true | |
1370 | 1309 | else isManager(i)) | |
1371 | 1310 | then true | |
1372 | 1311 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 1)) | |
1373 | 1312 | then true | |
1374 | 1313 | else throwErr("exactly 1 payment are expected")] | |
1375 | 1314 | if ((checks == checks)) | |
1376 | 1315 | then { | |
1377 | - | let $ | |
1378 | - | let state = $ | |
1379 | - | let totalAmount = $ | |
1316 | + | let $t04820248357 = getOneTknV2Internal(outAssetId, minOutAmount, i.payments, i.caller, i.originCaller, i.transactionId) | |
1317 | + | let state = $t04820248357._1 | |
1318 | + | let totalAmount = $t04820248357._2 | |
1380 | 1319 | $Tuple2(state, totalAmount) | |
1381 | 1320 | } | |
1382 | 1321 | else throw("Strict value is not equal to itself.") | |
1383 | 1322 | } | |
1384 | 1323 | ||
1385 | 1324 | ||
1386 | 1325 | ||
1387 | 1326 | @Callable(i) | |
1388 | 1327 | func refreshDLp () = { | |
1389 | 1328 | let lastRefreshedBlockHeight = valueOrElse(getInteger(keyDLpRefreshedHeight), 0) | |
1390 | 1329 | let checkLastRefreshedBlockHeight = if (((height - lastRefreshedBlockHeight) >= dLpRefreshDelay)) | |
1391 | 1330 | then unit | |
1392 | 1331 | else throwErr(makeString([toString(dLpRefreshDelay), " blocks have not passed since the previous call"], "")) | |
1393 | 1332 | if ((checkLastRefreshedBlockHeight == checkLastRefreshedBlockHeight)) | |
1394 | 1333 | then { | |
1395 | 1334 | let dLp = valueOrErrorMessage(parseBigInt(valueOrElse(getString(this, keyDLp), "0")), fmtErr("invalid dLp")) | |
1396 | - | let $ | |
1397 | - | let dLpUpdateActions = $ | |
1398 | - | let updatedDLp = $ | |
1335 | + | let $t04888148945 = refreshDLpInternal(0, 0, 0) | |
1336 | + | let dLpUpdateActions = $t04888148945._1 | |
1337 | + | let updatedDLp = $t04888148945._2 | |
1399 | 1338 | let actions = if ((dLp != updatedDLp)) | |
1400 | 1339 | then dLpUpdateActions | |
1401 | 1340 | else throwErr("nothing to refresh") | |
1402 | 1341 | $Tuple2(actions, toString(updatedDLp)) | |
1403 | 1342 | } | |
1404 | 1343 | else throw("Strict value is not equal to itself.") | |
1405 | 1344 | } | |
1406 | 1345 | ||
1407 | 1346 | ||
1408 | 1347 | ||
1409 | 1348 | @Callable(i) | |
1410 | 1349 | func getOneTknV2READONLY (outAssetId,lpAssetAmount) = { | |
1411 | 1350 | let amId = toBase58String(value(cfgAmountAssetId)) | |
1412 | 1351 | let prId = toBase58String(value(cfgPriceAssetId)) | |
1413 | 1352 | let lpId = toBase58String(value(cfgLpAssetId)) | |
1414 | 1353 | let xp = [toBigInt(getAccBalance(amId)), toBigInt(getAccBalance(prId))] | |
1415 | 1354 | let lpEmission = toBigInt(valueOrErrorMessage(assetInfo(fromBase58String(lpId)), "invalid lp asset").quantity) | |
1416 | 1355 | let D0 = getD(xp) | |
1417 | 1356 | let D1 = (D0 - fraction(toBigInt(lpAssetAmount), D0, lpEmission)) | |
1418 | 1357 | let index = if ((outAssetId == amId)) | |
1419 | 1358 | then 0 | |
1420 | 1359 | else if ((outAssetId == prId)) | |
1421 | 1360 | then 1 | |
1422 | 1361 | else throw("invalid out asset id") | |
1423 | 1362 | let newY = getYD(xp, index, D1) | |
1424 | 1363 | let dy = (xp[index] - newY) | |
1425 | 1364 | let totalGetRaw = max([0, toInt((dy - big1))]) | |
1426 | - | let $ | |
1427 | - | let totalGet = $ | |
1428 | - | let feeAmount = $ | |
1365 | + | let $t04995550010 = takeFee(totalGetRaw, outFee) | |
1366 | + | let totalGet = $t04995550010._1 | |
1367 | + | let feeAmount = $t04995550010._2 | |
1429 | 1368 | $Tuple2(nil, $Tuple2(totalGet, feeAmount)) | |
1430 | 1369 | } | |
1431 | 1370 | ||
1432 | 1371 | ||
1433 | 1372 | ||
1434 | 1373 | @Callable(i) | |
1435 | 1374 | func getOneTknV2WithBonusREADONLY (outAssetId,lpAssetAmount) = { | |
1436 | 1375 | let amId = toBase58String(value(cfgAmountAssetId)) | |
1437 | 1376 | let prId = toBase58String(value(cfgPriceAssetId)) | |
1438 | 1377 | let lpId = toBase58String(value(cfgLpAssetId)) | |
1439 | 1378 | let amBalance = getAccBalance(amId) | |
1440 | 1379 | let prBalance = getAccBalance(prId) | |
1441 | - | let $ | |
1380 | + | let $t05038550500 = { | |
1442 | 1381 | let @ = invoke(this, "getOneTknV2READONLY", [outAssetId, lpAssetAmount], nil) | |
1443 | 1382 | if ($isInstanceOf(@, "(Int, Int)")) | |
1444 | 1383 | then @ | |
1445 | 1384 | else throw(($getType(@) + " couldn't be cast to (Int, Int)")) | |
1446 | 1385 | } | |
1447 | - | let totalGet = $ | |
1448 | - | let feeAmount = $ | |
1386 | + | let totalGet = $t05038550500._1 | |
1387 | + | let feeAmount = $t05038550500._2 | |
1449 | 1388 | let r = ego("", lpId, lpAssetAmount, this) | |
1450 | 1389 | let outAmAmt = r._1 | |
1451 | 1390 | let outPrAmt = r._2 | |
1452 | 1391 | let sumOfGetAssets = (outAmAmt + outPrAmt) | |
1453 | 1392 | let bonus = if ((sumOfGetAssets == 0)) | |
1454 | 1393 | then if ((totalGet == 0)) | |
1455 | 1394 | then 0 | |
1456 | 1395 | else throw("bonus calculation error") | |
1457 | 1396 | else fraction((totalGet - sumOfGetAssets), scale8, sumOfGetAssets) | |
1458 | 1397 | $Tuple2(nil, $Tuple3(totalGet, feeAmount, bonus)) | |
1459 | 1398 | } | |
1460 | 1399 | ||
1461 | 1400 | ||
1462 | 1401 | ||
1463 | 1402 | @Callable(i) | |
1464 | 1403 | func getNoLess (noLessThenAmtAsset,noLessThenPriceAsset) = { | |
1465 | 1404 | let r = cg(i) | |
1466 | 1405 | let outAmAmt = r._1 | |
1467 | 1406 | let outPrAmt = r._2 | |
1468 | 1407 | let pmtAmt = r._3 | |
1469 | 1408 | let pmtAssetId = r._4 | |
1470 | 1409 | let state = r._5 | |
1471 | 1410 | if ((noLessThenAmtAsset > outAmAmt)) | |
1472 | 1411 | then throw(((("Failed: " + toString(outAmAmt)) + " < ") + toString(noLessThenAmtAsset))) | |
1473 | 1412 | else if ((noLessThenPriceAsset > outPrAmt)) | |
1474 | 1413 | then throw(((("Failed: " + toString(outPrAmt)) + " < ") + toString(noLessThenPriceAsset))) | |
1475 | 1414 | else { | |
1476 | 1415 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1477 | 1416 | if ((currentDLp == currentDLp)) | |
1478 | 1417 | then { | |
1479 | 1418 | let burnLPAssetOnFactory = invoke(fca, "burn", [pmtAmt], [AttachedPayment(pmtAssetId, pmtAmt)]) | |
1480 | 1419 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1481 | 1420 | then { | |
1482 | - | let $ | |
1483 | - | let refreshDLpActions = $ | |
1484 | - | let updatedDLp = $ | |
1421 | + | let $t05166651747 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1422 | + | let refreshDLpActions = $t05166651747._1 | |
1423 | + | let updatedDLp = $t05166651747._2 | |
1485 | 1424 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1486 | 1425 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1487 | 1426 | then (state ++ refreshDLpActions) | |
1488 | 1427 | else throw("Strict value is not equal to itself.") | |
1489 | 1428 | } | |
1490 | 1429 | else throw("Strict value is not equal to itself.") | |
1491 | 1430 | } | |
1492 | 1431 | else throw("Strict value is not equal to itself.") | |
1493 | 1432 | } | |
1494 | 1433 | } | |
1495 | 1434 | ||
1496 | 1435 | ||
1497 | 1436 | ||
1498 | 1437 | @Callable(i) | |
1499 | 1438 | func unstakeAndGet (amount) = { | |
1500 | 1439 | let checkPayments = if ((size(i.payments) != 0)) | |
1501 | 1440 | then throw("No pmnts expd") | |
1502 | 1441 | else true | |
1503 | 1442 | if ((checkPayments == checkPayments)) | |
1504 | 1443 | then { | |
1505 | 1444 | let factoryCfg = gfc() | |
1506 | 1445 | let lpAssetId = cfgLpAssetId | |
1507 | 1446 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1508 | 1447 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1509 | 1448 | if ((currentDLp == currentDLp)) | |
1510 | 1449 | then { | |
1511 | 1450 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
1512 | 1451 | if ((unstakeInv == unstakeInv)) | |
1513 | 1452 | then { | |
1514 | 1453 | let r = ego(toBase58String(i.transactionId), toBase58String(lpAssetId), amount, i.caller) | |
1515 | 1454 | let outAmAmt = r._1 | |
1516 | 1455 | let outPrAmt = r._2 | |
1517 | 1456 | let sts = parseIntValue(r._9) | |
1518 | 1457 | let state = r._10 | |
1519 | 1458 | let v = if (if (igs()) | |
1520 | 1459 | then true | |
1521 | 1460 | else (sts == PoolShutdown)) | |
1522 | 1461 | then throw(("Blocked: " + toString(sts))) | |
1523 | 1462 | else true | |
1524 | 1463 | if ((v == v)) | |
1525 | 1464 | then { | |
1526 | 1465 | let burnA = invoke(fca, "burn", [amount], [AttachedPayment(lpAssetId, amount)]) | |
1527 | 1466 | if ((burnA == burnA)) | |
1528 | 1467 | then { | |
1529 | - | let $ | |
1530 | - | let refreshDLpActions = $ | |
1531 | - | let updatedDLp = $ | |
1468 | + | let $t05277452855 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1469 | + | let refreshDLpActions = $t05277452855._1 | |
1470 | + | let updatedDLp = $t05277452855._2 | |
1532 | 1471 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1533 | 1472 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1534 | 1473 | then (state ++ refreshDLpActions) | |
1535 | 1474 | else throw("Strict value is not equal to itself.") | |
1536 | 1475 | } | |
1537 | 1476 | else throw("Strict value is not equal to itself.") | |
1538 | 1477 | } | |
1539 | 1478 | else throw("Strict value is not equal to itself.") | |
1540 | 1479 | } | |
1541 | 1480 | else throw("Strict value is not equal to itself.") | |
1542 | 1481 | } | |
1543 | 1482 | else throw("Strict value is not equal to itself.") | |
1544 | 1483 | } | |
1545 | 1484 | else throw("Strict value is not equal to itself.") | |
1546 | 1485 | } | |
1547 | 1486 | ||
1548 | 1487 | ||
1549 | 1488 | ||
1550 | 1489 | @Callable(i) | |
1551 | 1490 | func unstakeAndGetNoLess (unstakeAmount,noLessThenAmountAsset,noLessThenPriceAsset) = { | |
1552 | 1491 | let isGetDisabled = if (igs()) | |
1553 | 1492 | then true | |
1554 | 1493 | else (cfgPoolStatus == PoolShutdown) | |
1555 | 1494 | let checks = [if (!(isGetDisabled)) | |
1556 | 1495 | then true | |
1557 | 1496 | else throw("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1558 | 1497 | then true | |
1559 | 1498 | else throw("no payments are expected")] | |
1560 | 1499 | if ((checks == checks)) | |
1561 | 1500 | then { | |
1562 | 1501 | let currentDLp = calcCurrentDLp(toBigInt(0), toBigInt(0), toBigInt(0)) | |
1563 | 1502 | if ((currentDLp == currentDLp)) | |
1564 | 1503 | then { | |
1565 | 1504 | let unstakeInv = invoke(stakingContract, "unstake", [toBase58String(cfgLpAssetId), unstakeAmount], nil) | |
1566 | 1505 | if ((unstakeInv == unstakeInv)) | |
1567 | 1506 | then { | |
1568 | 1507 | let res = ego(toBase58String(i.transactionId), toBase58String(cfgLpAssetId), unstakeAmount, i.caller) | |
1569 | 1508 | let outAmAmt = res._1 | |
1570 | 1509 | let outPrAmt = res._2 | |
1571 | 1510 | let state = res._10 | |
1572 | 1511 | let checkAmounts = [if ((outAmAmt >= noLessThenAmountAsset)) | |
1573 | 1512 | then true | |
1574 | 1513 | else throw(makeString(["amount asset amount to receive is less than ", toString(noLessThenAmountAsset)], "")), if ((outPrAmt >= noLessThenPriceAsset)) | |
1575 | 1514 | then true | |
1576 | 1515 | else throw(makeString(["price asset amount to receive is less than ", toString(noLessThenPriceAsset)], ""))] | |
1577 | 1516 | if ((checkAmounts == checkAmounts)) | |
1578 | 1517 | then { | |
1579 | 1518 | let burnLPAssetOnFactory = invoke(fca, "burn", [unstakeAmount], [AttachedPayment(cfgLpAssetId, unstakeAmount)]) | |
1580 | 1519 | if ((burnLPAssetOnFactory == burnLPAssetOnFactory)) | |
1581 | 1520 | then { | |
1582 | - | let $ | |
1583 | - | let refreshDLpActions = $ | |
1584 | - | let updatedDLp = $ | |
1521 | + | let $t05410654187 = refreshDLpInternal(-(outAmAmt), -(outPrAmt), 0) | |
1522 | + | let refreshDLpActions = $t05410654187._1 | |
1523 | + | let updatedDLp = $t05410654187._2 | |
1585 | 1524 | let isUpdatedDLpValid = validateUpdatedDLp(currentDLp, updatedDLp) | |
1586 | 1525 | if ((isUpdatedDLpValid == isUpdatedDLpValid)) | |
1587 | 1526 | then (state ++ refreshDLpActions) | |
1588 | 1527 | else throw("Strict value is not equal to itself.") | |
1589 | 1528 | } | |
1590 | 1529 | else throw("Strict value is not equal to itself.") | |
1591 | 1530 | } | |
1592 | 1531 | else throw("Strict value is not equal to itself.") | |
1593 | 1532 | } | |
1594 | 1533 | else throw("Strict value is not equal to itself.") | |
1595 | 1534 | } | |
1596 | 1535 | else throw("Strict value is not equal to itself.") | |
1597 | 1536 | } | |
1598 | 1537 | else throw("Strict value is not equal to itself.") | |
1599 | 1538 | } | |
1600 | 1539 | ||
1601 | 1540 | ||
1602 | 1541 | ||
1603 | 1542 | @Callable(i) | |
1604 | 1543 | func unstakeAndGetOneTknV2 (unstakeAmount,outAssetId,minOutAmount) = { | |
1605 | 1544 | let isPoolOneTokenOperationsDisabled = { | |
1606 | 1545 | let @ = invoke(fca, "isPoolOneTokenOperationsDisabledREADONLY", [toString(this)], nil) | |
1607 | 1546 | if ($isInstanceOf(@, "Boolean")) | |
1608 | 1547 | then @ | |
1609 | 1548 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
1610 | 1549 | } | |
1611 | 1550 | let isGetDisabled = if (if (igs()) | |
1612 | 1551 | then true | |
1613 | 1552 | else (cfgPoolStatus == PoolShutdown)) | |
1614 | 1553 | then true | |
1615 | 1554 | else isPoolOneTokenOperationsDisabled | |
1616 | 1555 | let checks = [if (if (!(isGetDisabled)) | |
1617 | 1556 | then true | |
1618 | 1557 | else isManager(i)) | |
1619 | 1558 | then true | |
1620 | 1559 | else throwErr("get operation is blocked by admin"), if ((size(i.payments) == 0)) | |
1621 | 1560 | then true | |
1622 | 1561 | else throwErr("no payments are expected")] | |
1623 | 1562 | if ((checks == checks)) | |
1624 | 1563 | then { | |
1625 | 1564 | let factoryCfg = gfc() | |
1626 | 1565 | let lpAssetId = cfgLpAssetId | |
1627 | 1566 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
1628 | 1567 | let userAddress = i.caller | |
1629 | 1568 | let lpAssetRecipientAddress = this | |
1630 | 1569 | let unstakeInv = invoke(staking, "unstakeINTERNAL", [lpAssetId, unstakeAmount, userAddress.bytes, lpAssetRecipientAddress.bytes], nil) | |
1631 | 1570 | if ((unstakeInv == unstakeInv)) | |
1632 | 1571 | then { | |
1633 | - | let $ | |
1634 | - | let state = $ | |
1635 | - | let totalAmount = $ | |
1572 | + | let $t05520955397 = getOneTknV2Internal(outAssetId, minOutAmount, [AttachedPayment(lpAssetId, unstakeAmount)], i.caller, i.originCaller, i.transactionId) | |
1573 | + | let state = $t05520955397._1 | |
1574 | + | let totalAmount = $t05520955397._2 | |
1636 | 1575 | $Tuple2(state, totalAmount) | |
1637 | 1576 | } | |
1638 | 1577 | else throw("Strict value is not equal to itself.") | |
1639 | 1578 | } | |
1640 | 1579 | else throw("Strict value is not equal to itself.") | |
1641 | 1580 | } | |
1642 | 1581 | ||
1643 | 1582 | ||
1644 | 1583 | ||
1645 | 1584 | @Callable(i) | |
1646 | 1585 | func putOneTknV2WithBonusREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1647 | - | let $ | |
1648 | - | let lpAmount = $ | |
1649 | - | let state = $ | |
1650 | - | let feeAmount = $ | |
1651 | - | let bonus = $ | |
1586 | + | let $t05552555628 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", true) | |
1587 | + | let lpAmount = $t05552555628._1 | |
1588 | + | let state = $t05552555628._2 | |
1589 | + | let feeAmount = $t05552555628._3 | |
1590 | + | let bonus = $t05552555628._4 | |
1652 | 1591 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1653 | 1592 | } | |
1654 | 1593 | ||
1655 | 1594 | ||
1656 | 1595 | ||
1657 | 1596 | @Callable(i) | |
1658 | 1597 | func putOneTknV2WithoutTakeFeeREADONLY (paymentAmountRaw,paymentAssetId) = { | |
1659 | - | let $ | |
1660 | - | let lpAmount = $ | |
1661 | - | let state = $ | |
1662 | - | let feeAmount = $ | |
1663 | - | let bonus = $ | |
1598 | + | let $t05577655880 = calcPutOneTkn(paymentAmountRaw, paymentAssetId, "", "", false) | |
1599 | + | let lpAmount = $t05577655880._1 | |
1600 | + | let state = $t05577655880._2 | |
1601 | + | let feeAmount = $t05577655880._3 | |
1602 | + | let bonus = $t05577655880._4 | |
1664 | 1603 | $Tuple2(nil, $Tuple3(lpAmount, feeAmount, bonus)) | |
1665 | 1604 | } | |
1666 | 1605 | ||
1667 | 1606 | ||
1668 | 1607 | ||
1669 | 1608 | @Callable(i) | |
1670 | 1609 | func activate (amtAsStr,prAsStr) = if ((toString(i.caller) != toString(fca))) | |
1671 | 1610 | then throw("denied") | |
1672 | 1611 | else $Tuple2([StringEntry(aa(), amtAsStr), StringEntry(pa(), prAsStr), StringEntry(amp(), toString(ampInitial))], "success") | |
1673 | 1612 | ||
1674 | 1613 | ||
1675 | 1614 | ||
1676 | 1615 | @Callable(i) | |
1677 | 1616 | func getPoolConfigWrapperREADONLY () = $Tuple2(nil, gpc()) | |
1678 | 1617 | ||
1679 | 1618 | ||
1680 | 1619 | ||
1681 | 1620 | @Callable(i) | |
1682 | 1621 | func getAccBalanceWrapperREADONLY (assetId) = $Tuple2(nil, getAccBalance(assetId)) | |
1683 | 1622 | ||
1684 | 1623 | ||
1685 | 1624 | ||
1686 | 1625 | @Callable(i) | |
1687 | 1626 | func calcPricesWrapperREADONLY (amAmt,prAmt,lpAmt) = { | |
1688 | 1627 | let pr = calcPrices(amAmt, prAmt, lpAmt) | |
1689 | 1628 | $Tuple2(nil, [toString(pr[0]), toString(pr[1]), toString(pr[2])]) | |
1690 | 1629 | } | |
1691 | 1630 | ||
1692 | 1631 | ||
1693 | 1632 | ||
1694 | 1633 | @Callable(i) | |
1695 | 1634 | func fromX18WrapperREADONLY (val,resScaleMult) = $Tuple2(nil, f1(parseBigIntValue(val), resScaleMult)) | |
1696 | 1635 | ||
1697 | 1636 | ||
1698 | 1637 | ||
1699 | 1638 | @Callable(i) | |
1700 | 1639 | func toX18WrapperREADONLY (origVal,origScaleMult) = $Tuple2(nil, toString(t1(origVal, origScaleMult))) | |
1701 | 1640 | ||
1702 | 1641 | ||
1703 | 1642 | ||
1704 | 1643 | @Callable(i) | |
1705 | 1644 | func calcPriceBigIntWrapperREADONLY (prAmtX18,amAmtX18) = $Tuple2(nil, toString(cpbi(parseBigIntValue(prAmtX18), parseBigIntValue(amAmtX18)))) | |
1706 | 1645 | ||
1707 | 1646 | ||
1708 | 1647 | ||
1709 | 1648 | @Callable(i) | |
1710 | 1649 | func estimatePutOperationWrapperREADONLY (txId58,slippage,inAmAmt,inAmId,inPrAmt,inPrId,usrAddr,isEval,emitLp) = $Tuple2(nil, epo(txId58, slippage, inAmAmt, inAmId, inPrAmt, inPrId, usrAddr, isEval, emitLp, true, false, 0, "")) | |
1711 | 1650 | ||
1712 | 1651 | ||
1713 | 1652 | ||
1714 | 1653 | @Callable(i) | |
1715 | 1654 | func estimateGetOperationWrapperREADONLY (txId58,pmtAsId,pmtLpAmt,usrAddr) = { | |
1716 | 1655 | let r = ego(txId58, pmtAsId, pmtLpAmt, addressFromStringValue(usrAddr)) | |
1717 | 1656 | $Tuple2(nil, $Tuple10(r._1, r._2, r._3, r._4, r._5, r._6, r._7, toString(r._8), r._9, r._10)) | |
1718 | 1657 | } | |
1719 | 1658 | ||
1720 | 1659 | ||
1721 | 1660 | ||
1722 | 1661 | @Callable(i) | |
1723 | 1662 | func changeAmp () = { | |
1724 | 1663 | let cfg = invoke(fca, "getChangeAmpConfigREADONLY", [toString(this)], nil) | |
1725 | - | let $ | |
1664 | + | let $t05828958488 = match cfg { | |
1726 | 1665 | case list: List[Any] => | |
1727 | 1666 | $Tuple3({ | |
1728 | 1667 | let @ = list[0] | |
1729 | 1668 | if ($isInstanceOf(@, "Int")) | |
1730 | 1669 | then @ | |
1731 | 1670 | else throw(($getType(@) + " couldn't be cast to Int")) | |
1732 | 1671 | }, { | |
1733 | 1672 | let @ = list[1] | |
1734 | 1673 | if ($isInstanceOf(@, "Int")) | |
1735 | 1674 | then @ | |
1736 | 1675 | else throw(($getType(@) + " couldn't be cast to Int")) | |
1737 | 1676 | }, { | |
1738 | 1677 | let @ = list[2] | |
1739 | 1678 | if ($isInstanceOf(@, "Int")) | |
1740 | 1679 | then @ | |
1741 | 1680 | else throw(($getType(@) + " couldn't be cast to Int")) | |
1742 | 1681 | }) | |
1743 | 1682 | case _ => | |
1744 | 1683 | throwErr("invalid entry type") | |
1745 | 1684 | } | |
1746 | - | let delay = $ | |
1747 | - | let delta = $ | |
1748 | - | let target = $ | |
1685 | + | let delay = $t05828958488._1 | |
1686 | + | let delta = $t05828958488._2 | |
1687 | + | let target = $t05828958488._3 | |
1749 | 1688 | let curAmp = parseIntValue(getStringValue(amp())) | |
1750 | 1689 | let newAmpRaw = (curAmp + delta) | |
1751 | 1690 | let newAmp = if ((0 > delta)) | |
1752 | 1691 | then if ((target > newAmpRaw)) | |
1753 | 1692 | then target | |
1754 | 1693 | else newAmpRaw | |
1755 | 1694 | else if ((newAmpRaw > target)) | |
1756 | 1695 | then target | |
1757 | 1696 | else newAmpRaw | |
1758 | 1697 | let lastCall = valueOrElse(getInteger(keyChangeAmpLastCall()), 0) | |
1759 | 1698 | let wait = (lastCall + delay) | |
1760 | 1699 | let checks = [if ((height > wait)) | |
1761 | 1700 | then true | |
1762 | 1701 | else throwErr("try again in few blocks"), if ((curAmp != newAmp)) | |
1763 | 1702 | then true | |
1764 | 1703 | else throwErr("already reached target")] | |
1765 | 1704 | if ((checks == checks)) | |
1766 | 1705 | then [IntegerEntry(keyChangeAmpLastCall(), height), StringEntry(amp(), toString(newAmp)), StringEntry(keyAmpHistory(height), toString(newAmp))] | |
1767 | 1706 | else throw("Strict value is not equal to itself.") | |
1768 | 1707 | } | |
1769 | 1708 | ||
1770 | 1709 | ||
1771 | 1710 | @Verifier(tx) | |
1772 | 1711 | func verify () = { | |
1773 | 1712 | let targetPublicKey = match m() { | |
1774 | 1713 | case pk: ByteVector => | |
1775 | 1714 | pk | |
1776 | 1715 | case _: Unit => | |
1777 | 1716 | tx.senderPublicKey | |
1778 | 1717 | case _ => | |
1779 | 1718 | throw("Match error") | |
1780 | 1719 | } | |
1781 | 1720 | match tx { | |
1782 | 1721 | case order: Order => | |
1783 | 1722 | let matcherPub = mp() | |
1784 | - | let $ | |
1723 | + | let $t05940059517 = if (skipOrderValidation()) | |
1785 | 1724 | then $Tuple2(true, "") | |
1786 | 1725 | else validateMatcherOrderAllowed(order) | |
1787 | - | let orderValid = $ | |
1788 | - | let orderValidInfo = $ | |
1726 | + | let orderValid = $t05940059517._1 | |
1727 | + | let orderValidInfo = $t05940059517._2 | |
1789 | 1728 | let senderValid = sigVerify(order.bodyBytes, order.proofs[0], order.senderPublicKey) | |
1790 | 1729 | let matcherValid = sigVerify(order.bodyBytes, order.proofs[1], matcherPub) | |
1791 | 1730 | if (if (if (orderValid) | |
1792 | 1731 | then senderValid | |
1793 | 1732 | else false) | |
1794 | 1733 | then matcherValid | |
1795 | 1734 | else false) | |
1796 | 1735 | then true | |
1797 | 1736 | else throwOrderError(orderValid, orderValidInfo, senderValid, matcherValid) | |
1798 | 1737 | case s: SetScriptTransaction => | |
1799 | 1738 | if (sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)) | |
1800 | 1739 | then true | |
1801 | 1740 | else { | |
1802 | 1741 | let newHash = blake2b256(value(s.script)) | |
1803 | 1742 | let allowedHash = fromBase64String(value(getString(fca, keyAllowedLpStableScriptHash()))) | |
1804 | 1743 | let currentHash = scriptHash(this) | |
1805 | 1744 | if ((allowedHash == newHash)) | |
1806 | 1745 | then (currentHash != newHash) | |
1807 | 1746 | else false | |
1808 | 1747 | } | |
1809 | 1748 | case _ => | |
1810 | 1749 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1811 | 1750 | } | |
1812 | 1751 | } | |
1813 | 1752 |
github/deemru/w8io/169f3d6 235.61 ms ◑