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