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