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