tx · J3TVmgT8PyjuC79UYd5WQwk7C35aW6ZrydDEc1yo7zhA 3N8G95pEaYEhZ4U3m3UrzpEzwBFn5vvXsZH: -0.05000000 Waves 2022.07.05 10:07 [2126054] smart account 3N8G95pEaYEhZ4U3m3UrzpEzwBFn5vvXsZH > SELF 0.00000000 Waves
{ "type": 13, "id": "J3TVmgT8PyjuC79UYd5WQwk7C35aW6ZrydDEc1yo7zhA", "fee": 5000000, "feeAssetId": null, "timestamp": 1657004900540, "version": 2, "chainId": 84, "sender": "3N8G95pEaYEhZ4U3m3UrzpEzwBFn5vvXsZH", "senderPublicKey": "Hj6oyH6As5UWo8fZ1K4hPsEY7nxH3MvhBqDD6axiwjXs", "proofs": [ "4ArbeUsrU59ruVTHzxmMvE7d2hisBpEb5Z4NohT6Gh7t7PMgbUe5474at81rzKAJHv7LWh19y6QA1Bs5k8XMDqoy" ], "script": "base64:AAIFAAAAAAAAAEkIAhIAEgASCQoHAQEBAQEBARIOCgwBAQEBAQEBCAgIAQESBQoDAQEBEgUKAwEBARIAEgMKAQESABIDCgEIEgASAwoBCBIDCgEIAAAAcAAAAAAJa19vcmFfa2V5AgAAAAlrX29yYV9rZXkAAAAAD2tfb3JhX2Jsb2NrX2tleQIAAAAPa19vcmFfYmxvY2tfa2V5AAAAAAVrX29yYQIAAAAFa19vcmEAAAAACWtfYmFsYW5jZQIAAAAJa19iYWxhbmNlAAAAAA5rX3Bvc2l0aW9uU2l6ZQIAAAAOa19wb3NpdGlvblNpemUAAAAAEGtfcG9zaXRpb25NYXJnaW4CAAAAEGtfcG9zaXRpb25NYXJnaW4AAAAAFmtfcG9zaXRpb25PcGVuTm90aW9uYWwCAAAAFmtfcG9zaXRpb25PcGVuTm90aW9uYWwAAAAALmtfcG9zaXRpb25MYXN0VXBkYXRlZEN1bXVsYXRpdmVQcmVtaXVtRnJhY3Rpb24CAAAAEmtfcG9zaXRpb25GcmFjdGlvbgAAAAANa19pbml0aWFsaXplZAIAAAANa19pbml0aWFsaX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dGlvbk5vdGlvbmFsCAUAAAANJHQwNDM2NzY0Mzc3NwAAAAJfMQQAAAANdW5yZWFsaXplZFBubAgFAAAADSR0MDQzNjc2NDM3NzcAAAACXzIEAAAADSR0MDQzNzgyNDM5NjQJAQAAACJjYWxjUmVtYWluTWFyZ2luV2l0aEZ1bmRpbmdQYXltZW50AAAABAUAAAAMcG9zaXRpb25TaXplBQAAAA5wb3NpdGlvbk1hcmdpbgUAAAARcG9zaXRpb25Mc3RVcGRDUEYFAAAADXVucmVhbGl6ZWRQbmwEAAAADHJlbWFpbk1hcmdpbggFAAAADSR0MDQzNzgyNDM5NjQAAAACXzEEAAAAB2JhZERlYnQIBQAAAA0kdDA0Mzc4MjQzOTY0AAAAAl8yBAAAAA5mdW5kaW5nUGF5bWVudAgFAAAADSR0MDQzNzgyNDM5NjQAAAACXzMJAAACAAAAAQkAASwAAAACCQABLAAAAAIJAQAAAAFzAAAAAQUAAAAMcmVtYWluTWFyZ2luCQEAAAABcwAAAAEFAAAADmZ1bmRpbmdQYXltZW50CQEAAAABcwAAAAEJAQAAAA5nZXRNYXJnaW5SYXRpbwAAAAEFAAAAB190cmFkZXIAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAkBAAAADmFkbWluUHVibGljS2V5AAAAAAkU/Es=", "height": 2126054, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FYSNibP2BnGQCBdyEbDb9NWMDYi5X2o4CJ61M9HTTZ8e Next: 48ix1BtdDrrCKhQc2XfhKKxJpRfecRoSiGgXb6mUae6m Diff:
Old | New | Differences | |
---|---|---|---|
594 | 594 | ||
595 | 595 | ||
596 | 596 | @Callable(i) | |
597 | - | func decreasePosition (_direction,_amount,_leverage,_minBaseAssetAmount) = if (if (if (if (if (if (if (if ((_direction != DIR_LONG)) | |
598 | - | then (_direction != DIR_SHORT) | |
599 | - | else false) | |
600 | - | then true | |
601 | - | else (0 >= _amount)) | |
597 | + | func decreasePosition (_amount,_leverage,_minBaseAssetAmount) = if (if (if (if (if (if ((0 >= _amount)) | |
602 | 598 | then true | |
603 | 599 | else if (((1 * DECIMAL_UNIT) > _leverage)) | |
604 | 600 | then true | |
613 | 609 | else paused()) | |
614 | 610 | then throw("Invalid decreasePosition parameters") | |
615 | 611 | else { | |
616 | - | let $ | |
617 | - | let oldPositionSize = $ | |
618 | - | let oldPositionMargin = $ | |
619 | - | let oldPositionOpenNotional = $ | |
620 | - | let oldPositionLstUpdCPF = $ | |
621 | - | let | |
622 | - | then | |
623 | - | else | |
612 | + | let $t02672326875 = getPosition(toString(i.caller)) | |
613 | + | let oldPositionSize = $t02672326875._1 | |
614 | + | let oldPositionMargin = $t02672326875._2 | |
615 | + | let oldPositionOpenNotional = $t02672326875._3 | |
616 | + | let oldPositionLstUpdCPF = $t02672326875._4 | |
617 | + | let _direction = if ((oldPositionSize > 0)) | |
618 | + | then DIR_SHORT | |
619 | + | else DIR_LONG | |
624 | 620 | let isAdd = (_direction == DIR_LONG) | |
625 | - | let $t02713730158 = if (expandExisting) | |
626 | - | then throw("Use increasePosition to open new or increase position") | |
627 | - | else { | |
628 | - | let openNotional = muld(_amount, _leverage) | |
629 | - | let $t02762627742 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT) | |
630 | - | let oldPositionNotional = $t02762627742._1 | |
631 | - | let unrealizedPnl = $t02762627742._2 | |
632 | - | if ((oldPositionNotional > openNotional)) | |
633 | - | then { | |
634 | - | let $t02780428034 = swapInput(isAdd, openNotional) | |
635 | - | let exchangedPositionSize = $t02780428034._1 | |
636 | - | let quoteAssetReserveAfter = $t02780428034._2 | |
637 | - | let baseAssetReserveAfter = $t02780428034._3 | |
638 | - | let totalPositionSizeAfter = $t02780428034._4 | |
639 | - | let cumulativeNotionalAfter = $t02780428034._5 | |
640 | - | let exchangedPositionSizeAbs = abs(exchangedPositionSize) | |
641 | - | if (if ((_minBaseAssetAmount != 0)) | |
642 | - | then (_minBaseAssetAmount > exchangedPositionSizeAbs) | |
643 | - | else false) | |
644 | - | then throw(((("Too little base asset exchanged, got " + toString(exchangedPositionSizeAbs)) + " expected ") + toString(_minBaseAssetAmount))) | |
645 | - | else { | |
646 | - | let realizedPnl = if ((oldPositionSize != 0)) | |
647 | - | then divd(muld(unrealizedPnl, exchangedPositionSizeAbs), oldPositionSize) | |
648 | - | else 0 | |
649 | - | let $t02857428831 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl) | |
650 | - | let remainMargin = $t02857428831._1 | |
651 | - | let badDebt = $t02857428831._2 | |
652 | - | let fundingPayment = $t02857428831._3 | |
653 | - | let exchangedQuoteAssetAmount = openNotional | |
654 | - | let unrealizedPnlAfter = (unrealizedPnl - realizedPnl) | |
655 | - | let remainOpenNotional = if ((oldPositionSize > 0)) | |
656 | - | then ((oldPositionNotional - exchangedQuoteAssetAmount) - unrealizedPnlAfter) | |
657 | - | else ((unrealizedPnlAfter + oldPositionNotional) - exchangedQuoteAssetAmount) | |
658 | - | let newPositionSize = (oldPositionSize + exchangedPositionSize) | |
659 | - | $Tuple11(newPositionSize, remainMargin, abs(remainOpenNotional), latestCumulativePremiumFraction(newPositionSize), baseAssetReserveAfter, quoteAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, (openInterestNotional() - openNotional), (totalLongPositionSize() - (if ((newPositionSize > 0)) | |
660 | - | then abs(exchangedPositionSize) | |
661 | - | else 0)), (totalShortPositionSize() - (if ((0 > newPositionSize)) | |
662 | - | then abs(exchangedPositionSize) | |
663 | - | else 0))) | |
664 | - | } | |
621 | + | let openNotional = muld(_amount, _leverage) | |
622 | + | let $t02704827164 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT) | |
623 | + | let oldPositionNotional = $t02704827164._1 | |
624 | + | let unrealizedPnl = $t02704827164._2 | |
625 | + | let $t02717029804 = if ((oldPositionNotional > openNotional)) | |
626 | + | then { | |
627 | + | let $t02754727766 = swapInput(isAdd, openNotional) | |
628 | + | let exchangedPositionSize = $t02754727766._1 | |
629 | + | let quoteAssetReserveAfter = $t02754727766._2 | |
630 | + | let baseAssetReserveAfter = $t02754727766._3 | |
631 | + | let totalPositionSizeAfter = $t02754727766._4 | |
632 | + | let cumulativeNotionalAfter = $t02754727766._5 | |
633 | + | let exchangedPositionSizeAbs = abs(exchangedPositionSize) | |
634 | + | if (if ((_minBaseAssetAmount != 0)) | |
635 | + | then (_minBaseAssetAmount > exchangedPositionSizeAbs) | |
636 | + | else false) | |
637 | + | then throw(((("Too little base asset exchanged, got " + toString(exchangedPositionSizeAbs)) + " expected ") + toString(_minBaseAssetAmount))) | |
638 | + | else { | |
639 | + | let realizedPnl = if ((oldPositionSize != 0)) | |
640 | + | then divd(muld(unrealizedPnl, exchangedPositionSizeAbs), oldPositionSize) | |
641 | + | else 0 | |
642 | + | let $t02828828533 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl) | |
643 | + | let remainMargin = $t02828828533._1 | |
644 | + | let badDebt = $t02828828533._2 | |
645 | + | let fundingPayment = $t02828828533._3 | |
646 | + | let exchangedQuoteAssetAmount = openNotional | |
647 | + | let unrealizedPnlAfter = (unrealizedPnl - realizedPnl) | |
648 | + | let remainOpenNotional = if ((oldPositionSize > 0)) | |
649 | + | then ((oldPositionNotional - exchangedQuoteAssetAmount) - unrealizedPnlAfter) | |
650 | + | else ((unrealizedPnlAfter + oldPositionNotional) - exchangedQuoteAssetAmount) | |
651 | + | let newPositionSize = (oldPositionSize + exchangedPositionSize) | |
652 | + | $Tuple11(newPositionSize, remainMargin, abs(remainOpenNotional), latestCumulativePremiumFraction(newPositionSize), baseAssetReserveAfter, quoteAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, (openInterestNotional() - openNotional), (totalLongPositionSize() - (if ((newPositionSize > 0)) | |
653 | + | then abs(exchangedPositionSize) | |
654 | + | else 0)), (totalShortPositionSize() - (if ((0 > newPositionSize)) | |
655 | + | then abs(exchangedPositionSize) | |
656 | + | else 0))) | |
665 | 657 | } | |
666 | - | else throw("Close position first") | |
667 | 658 | } | |
668 | - | let newPositionSize = $t02713730158._1 | |
669 | - | let newPositionRemainMargin = $t02713730158._2 | |
670 | - | let newPositionOpenNotional = $t02713730158._3 | |
671 | - | let newPositionLatestCPF = $t02713730158._4 | |
672 | - | let baseAssetReserveAfter = $t02713730158._5 | |
673 | - | let quoteAssetReserveAfter = $t02713730158._6 | |
674 | - | let totalPositionSizeAfter = $t02713730158._7 | |
675 | - | let cumulativeNotionalAfter = $t02713730158._8 | |
676 | - | let openInterestNotionalAfter = $t02713730158._9 | |
677 | - | let totalLongAfter = $t02713730158._10 | |
678 | - | let totalShortAfter = $t02713730158._11 | |
659 | + | else throw("Close position first") | |
660 | + | let newPositionSize = $t02717029804._1 | |
661 | + | let newPositionRemainMargin = $t02717029804._2 | |
662 | + | let newPositionOpenNotional = $t02717029804._3 | |
663 | + | let newPositionLatestCPF = $t02717029804._4 | |
664 | + | let baseAssetReserveAfter = $t02717029804._5 | |
665 | + | let quoteAssetReserveAfter = $t02717029804._6 | |
666 | + | let totalPositionSizeAfter = $t02717029804._7 | |
667 | + | let cumulativeNotionalAfter = $t02717029804._8 | |
668 | + | let openInterestNotionalAfter = $t02717029804._9 | |
669 | + | let totalLongAfter = $t02717029804._10 | |
670 | + | let totalShortAfter = $t02717029804._11 | |
679 | 671 | (updatePosition(toString(i.caller), newPositionSize, newPositionRemainMargin, newPositionOpenNotional, newPositionLatestCPF) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter)) | |
680 | 672 | } | |
681 | 673 | ||
705 | 697 | else { | |
706 | 698 | let feeAmount = muld(_rawAmount, fee()) | |
707 | 699 | let _amount = (_rawAmount - feeAmount) | |
708 | - | let $t03119431318 = getPosition(toString(i.caller)) | |
709 | - | let oldPositionSize = $t03119431318._1 | |
710 | - | let oldPositionMargin = $t03119431318._2 | |
711 | - | let oldPositionOpenNotional = $t03119431318._3 | |
700 | + | let $t03084030992 = getPosition(toString(i.caller)) | |
701 | + | let oldPositionSize = $t03084030992._1 | |
702 | + | let oldPositionMargin = $t03084030992._2 | |
703 | + | let oldPositionOpenNotional = $t03084030992._3 | |
704 | + | let oldPositionLstUpdCPF = $t03084030992._4 | |
712 | 705 | let isNewPosition = (oldPositionSize == 0) | |
713 | 706 | let isSameDirection = if ((oldPositionSize > 0)) | |
714 | 707 | then (_direction == DIR_LONG) | |
717 | 710 | then isSameDirection | |
718 | 711 | else false | |
719 | 712 | let isAdd = (_direction == DIR_LONG) | |
720 | - | let $ | |
713 | + | let $t03128133670 = if (if (isNewPosition) | |
721 | 714 | then true | |
722 | 715 | else expandExisting) | |
723 | 716 | then { | |
724 | 717 | let openNotional = muld(_amount, _leverage) | |
725 | - | let $ | |
726 | - | let amountBaseAssetBought = $ | |
727 | - | let quoteAssetReserveAfter = $ | |
728 | - | let baseAssetReserveAfter = $ | |
729 | - | let totalPositionSizeAfter = $ | |
730 | - | let cumulativeNotionalAfter = $ | |
718 | + | let $t03170531911 = swapInput(isAdd, openNotional) | |
719 | + | let amountBaseAssetBought = $t03170531911._1 | |
720 | + | let quoteAssetReserveAfter = $t03170531911._2 | |
721 | + | let baseAssetReserveAfter = $t03170531911._3 | |
722 | + | let totalPositionSizeAfter = $t03170531911._4 | |
723 | + | let cumulativeNotionalAfter = $t03170531911._5 | |
731 | 724 | if (if ((_minBaseAssetAmount != 0)) | |
732 | 725 | then (_minBaseAssetAmount > abs(amountBaseAssetBought)) | |
733 | 726 | else false) | |
734 | 727 | then throw(((("Limit error: " + toString(abs(amountBaseAssetBought))) + " < ") + toString(_minBaseAssetAmount))) | |
735 | 728 | else { | |
736 | 729 | let newPositionSize = (oldPositionSize + amountBaseAssetBought) | |
737 | - | let positionLstUpdCPF = if (isNewPosition) | |
738 | - | then latestCumulativePremiumFraction(newPositionSize) | |
739 | - | else getPosition(toString(i.caller))._4 | |
740 | 730 | let increaseMarginRequirement = divd(openNotional, _leverage) | |
741 | - | let $ | |
742 | - | let remainMargin = $ | |
743 | - | let x1 = $ | |
744 | - | let x2 = $ | |
731 | + | let $t03229232531 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, increaseMarginRequirement) | |
732 | + | let remainMargin = $t03229232531._1 | |
733 | + | let x1 = $t03229232531._2 | |
734 | + | let x2 = $t03229232531._3 | |
745 | 735 | $Tuple11(newPositionSize, remainMargin, (oldPositionOpenNotional + openNotional), latestCumulativePremiumFraction(newPositionSize), baseAssetReserveAfter, quoteAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, (openInterestNotional() + openNotional), (totalLongPositionSize() + (if ((newPositionSize > 0)) | |
746 | 736 | then abs(amountBaseAssetBought) | |
747 | 737 | else 0)), (totalShortPositionSize() + (if ((0 > newPositionSize)) | |
751 | 741 | } | |
752 | 742 | else { | |
753 | 743 | let openNotional = muld(_amount, _leverage) | |
754 | - | let $ | |
755 | - | let oldPositionNotional = $ | |
756 | - | let unrealizedPnl = $ | |
744 | + | let $t03336333479 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT) | |
745 | + | let oldPositionNotional = $t03336333479._1 | |
746 | + | let unrealizedPnl = $t03336333479._2 | |
757 | 747 | if ((oldPositionNotional > openNotional)) | |
758 | 748 | then throw("Use decreasePosition to decrease position size") | |
759 | 749 | else throw("Close position first") | |
760 | 750 | } | |
761 | - | let newPositionSize = $ | |
762 | - | let newPositionRemainMargin = $ | |
763 | - | let newPositionOpenNotional = $ | |
764 | - | let newPositionLatestCPF = $ | |
765 | - | let baseAssetReserveAfter = $ | |
766 | - | let quoteAssetReserveAfter = $ | |
767 | - | let totalPositionSizeAfter = $ | |
768 | - | let cumulativeNotionalAfter = $ | |
769 | - | let openInterestNotionalAfter = $ | |
770 | - | let totalLongAfter = $ | |
771 | - | let totalShortAfter = $ | |
751 | + | let newPositionSize = $t03128133670._1 | |
752 | + | let newPositionRemainMargin = $t03128133670._2 | |
753 | + | let newPositionOpenNotional = $t03128133670._3 | |
754 | + | let newPositionLatestCPF = $t03128133670._4 | |
755 | + | let baseAssetReserveAfter = $t03128133670._5 | |
756 | + | let quoteAssetReserveAfter = $t03128133670._6 | |
757 | + | let totalPositionSizeAfter = $t03128133670._7 | |
758 | + | let cumulativeNotionalAfter = $t03128133670._8 | |
759 | + | let openInterestNotionalAfter = $t03128133670._9 | |
760 | + | let totalLongAfter = $t03128133670._10 | |
761 | + | let totalShortAfter = $t03128133670._11 | |
772 | 762 | let feeToStakers = (feeAmount / 2) | |
773 | 763 | let feeToInsurance = (feeAmount - feeToStakers) | |
774 | 764 | let stake = invoke(quoteAssetStaking(), "lockNeutrinoSP", [toString(stakingAddress()), ALL_FEES], [AttachedPayment(quoteAsset(), _amount)]) | |
799 | 789 | else { | |
800 | 790 | let feeAmount = muld(_rawAmount, fee()) | |
801 | 791 | let _amount = (_rawAmount - feeAmount) | |
802 | - | let $ | |
803 | - | let oldPositionSize = $ | |
804 | - | let oldPositionMargin = $ | |
805 | - | let oldPositionOpenNotional = $ | |
806 | - | let oldPositionLstUpdCPF = $ | |
792 | + | let $t03494635098 = getPosition(toString(i.caller)) | |
793 | + | let oldPositionSize = $t03494635098._1 | |
794 | + | let oldPositionMargin = $t03494635098._2 | |
795 | + | let oldPositionOpenNotional = $t03494635098._3 | |
796 | + | let oldPositionLstUpdCPF = $t03494635098._4 | |
807 | 797 | let feeToStakers = (feeAmount / 2) | |
808 | 798 | let feeToInsurance = (feeAmount - feeToStakers) | |
809 | 799 | let stake = invoke(quoteAssetStaking(), "lockNeutrinoSP", [toString(stakingAddress()), ALL_FEES], [AttachedPayment(quoteAsset(), _amount)]) | |
830 | 820 | else paused()) | |
831 | 821 | then throw("Invalid removeMargin parameters") | |
832 | 822 | else { | |
833 | - | let $ | |
834 | - | let oldPositionSize = $ | |
835 | - | let oldPositionMargin = $ | |
836 | - | let oldPositionOpenNotional = $ | |
837 | - | let oldPositionLstUpdCPF = $ | |
823 | + | let $t03601836170 = getPosition(toString(i.caller)) | |
824 | + | let oldPositionSize = $t03601836170._1 | |
825 | + | let oldPositionMargin = $t03601836170._2 | |
826 | + | let oldPositionOpenNotional = $t03601836170._3 | |
827 | + | let oldPositionLstUpdCPF = $t03601836170._4 | |
838 | 828 | let marginDelta = -(_amount) | |
839 | - | let $ | |
840 | - | let remainMargin = $ | |
841 | - | let badDebt = $ | |
829 | + | let $t03620736386 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, marginDelta) | |
830 | + | let remainMargin = $t03620736386._1 | |
831 | + | let badDebt = $t03620736386._2 | |
842 | 832 | if ((badDebt != 0)) | |
843 | 833 | then throw("Invalid added margin amount") | |
844 | 834 | else { | |
859 | 849 | else paused()) | |
860 | 850 | then throw("Invalid closePosition parameters") | |
861 | 851 | else { | |
862 | - | let $ | |
863 | - | let x1 = $ | |
864 | - | let positionBadDebt = $ | |
865 | - | let realizedPnl = $ | |
866 | - | let marginToVault = $ | |
867 | - | let quoteAssetReserveAfter = $ | |
868 | - | let baseAssetReserveAfter = $ | |
869 | - | let totalPositionSizeAfter = $ | |
870 | - | let cumulativeNotionalAfter = $ | |
871 | - | let openInterestNotionalAfter = $ | |
872 | - | let x2 = $ | |
873 | - | let totalLongAfter = $ | |
874 | - | let totalShortAfter = $ | |
852 | + | let $t03714637530 = internalClosePosition(toString(i.caller)) | |
853 | + | let x1 = $t03714637530._1 | |
854 | + | let positionBadDebt = $t03714637530._2 | |
855 | + | let realizedPnl = $t03714637530._3 | |
856 | + | let marginToVault = $t03714637530._4 | |
857 | + | let quoteAssetReserveAfter = $t03714637530._5 | |
858 | + | let baseAssetReserveAfter = $t03714637530._6 | |
859 | + | let totalPositionSizeAfter = $t03714637530._7 | |
860 | + | let cumulativeNotionalAfter = $t03714637530._8 | |
861 | + | let openInterestNotionalAfter = $t03714637530._9 | |
862 | + | let x2 = $t03714637530._10 | |
863 | + | let totalLongAfter = $t03714637530._11 | |
864 | + | let totalShortAfter = $t03714637530._12 | |
875 | 865 | if ((positionBadDebt > 0)) | |
876 | 866 | then throw("Unable to close position with bad debt") | |
877 | 867 | else { | |
878 | 868 | let withdrawAmount = abs(marginToVault) | |
879 | 869 | let ammBalance = (cbalance() - withdrawAmount) | |
880 | - | let $ | |
870 | + | let $t03773937881 = if ((0 > ammBalance)) | |
881 | 871 | then $Tuple2(0, abs(ammBalance)) | |
882 | 872 | else $Tuple2(ammBalance, 0) | |
883 | - | let ammNewBalance = $ | |
884 | - | let getFromInsurance = $ | |
873 | + | let ammNewBalance = $t03773937881._1 | |
874 | + | let getFromInsurance = $t03773937881._2 | |
885 | 875 | let x = if ((getFromInsurance > 0)) | |
886 | 876 | then { | |
887 | 877 | let withdrawInsurance = invoke(insuranceAddress(), "withdraw", [getFromInsurance], nil) | |
917 | 907 | else paused()) | |
918 | 908 | then throw("Unable to liquidate") | |
919 | 909 | else { | |
920 | - | let $ | |
921 | - | let x1 = $ | |
922 | - | let badDebt = $ | |
923 | - | let x2 = $ | |
924 | - | let marginToVault = $ | |
925 | - | let quoteAssetReserveAfter = $ | |
926 | - | let baseAssetReserveAfter = $ | |
927 | - | let totalPositionSizeAfter = $ | |
928 | - | let cumulativeNotionalAfter = $ | |
929 | - | let openInterestNotionalAfter = $ | |
930 | - | let exchangedQuoteAssetAmount = $ | |
931 | - | let totalLongAfter = $ | |
932 | - | let totalShortAfter = $ | |
910 | + | let $t03932039747 = internalClosePosition(_trader) | |
911 | + | let x1 = $t03932039747._1 | |
912 | + | let badDebt = $t03932039747._2 | |
913 | + | let x2 = $t03932039747._3 | |
914 | + | let marginToVault = $t03932039747._4 | |
915 | + | let quoteAssetReserveAfter = $t03932039747._5 | |
916 | + | let baseAssetReserveAfter = $t03932039747._6 | |
917 | + | let totalPositionSizeAfter = $t03932039747._7 | |
918 | + | let cumulativeNotionalAfter = $t03932039747._8 | |
919 | + | let openInterestNotionalAfter = $t03932039747._9 | |
920 | + | let exchangedQuoteAssetAmount = $t03932039747._10 | |
921 | + | let totalLongAfter = $t03932039747._11 | |
922 | + | let totalShortAfter = $t03932039747._12 | |
933 | 923 | let liquidationPenalty = muld(exchangedQuoteAssetAmount, liquidationFeeRatio()) | |
934 | 924 | let feeToLiquidator = (liquidationPenalty / 2) | |
935 | 925 | let feeToInsurance = (liquidationPenalty - feeToLiquidator) | |
936 | 926 | let ammBadDebt = (cbalance() - liquidationPenalty) | |
937 | - | let $ | |
927 | + | let $t04014540280 = if ((0 > ammBadDebt)) | |
938 | 928 | then $Tuple2(0, abs(ammBadDebt)) | |
939 | 929 | else $Tuple2(ammBadDebt, 0) | |
940 | - | let newAmmBalance = $ | |
941 | - | let takeFromInsurance = $ | |
930 | + | let newAmmBalance = $t04014540280._1 | |
931 | + | let takeFromInsurance = $t04014540280._2 | |
942 | 932 | let x = if ((takeFromInsurance > 0)) | |
943 | 933 | then { | |
944 | 934 | let withdrawInsurance = invoke(insuranceAddress(), "withdraw", [takeFromInsurance], nil) | |
978 | 968 | let underlyingPrice = getOracleTwapPrice() | |
979 | 969 | let spotTwapPrice = getTwapSpotPrice() | |
980 | 970 | let premium = (spotTwapPrice - underlyingPrice) | |
981 | - | let $ | |
971 | + | let $t04165042985 = if (if ((totalShortPositionSize() == 0)) | |
982 | 972 | then true | |
983 | 973 | else (totalLongPositionSize() == 0)) | |
984 | 974 | then $Tuple2(0, 0) | |
993 | 983 | let shortPremiumFraction = divd(muld(longPremiumFraction, totalLongPositionSize()), totalShortPositionSize()) | |
994 | 984 | $Tuple2(shortPremiumFraction, longPremiumFraction) | |
995 | 985 | } | |
996 | - | let shortPremiumFraction = $ | |
997 | - | let longPremiumFraction = $ | |
986 | + | let shortPremiumFraction = $t04165042985._1 | |
987 | + | let longPremiumFraction = $t04165042985._2 | |
998 | 988 | updateFunding((fundingBlockTimestamp + fundingPeriodSeconds()), (latestLongCumulativePremiumFraction() + longPremiumFraction), (latestShortCumulativePremiumFraction() + shortPremiumFraction), divd(longPremiumFraction, underlyingPrice), divd(shortPremiumFraction, underlyingPrice)) | |
999 | 989 | } | |
1000 | 990 | } | |
1003 | 993 | ||
1004 | 994 | @Callable(i) | |
1005 | 995 | func v_get (_trader) = { | |
1006 | - | let $ | |
1007 | - | let x1 = $ | |
1008 | - | let x2 = $ | |
1009 | - | let x3 = $ | |
1010 | - | let x4 = $ | |
996 | + | let $t04336043413 = internalClosePosition(_trader) | |
997 | + | let x1 = $t04336043413._1 | |
998 | + | let x2 = $t04336043413._2 | |
999 | + | let x3 = $t04336043413._3 | |
1000 | + | let x4 = $t04336043413._4 | |
1011 | 1001 | throw((((s(x2) + s(x3)) + s(x4)) + s(getMarginRatio(_trader)))) | |
1012 | 1002 | } | |
1013 | 1003 | ||
1015 | 1005 | ||
1016 | 1006 | @Callable(i) | |
1017 | 1007 | func view_calcRemainMarginWithFundingPayment (_trader) = { | |
1018 | - | let $ | |
1019 | - | let positionSize = $ | |
1020 | - | let positionMargin = $ | |
1021 | - | let pon = $ | |
1022 | - | let positionLstUpdCPF = $ | |
1023 | - | let $ | |
1024 | - | let positionNotional = $ | |
1025 | - | let unrealizedPnl = $ | |
1026 | - | let $ | |
1027 | - | let remainMargin = $ | |
1028 | - | let badDebt = $ | |
1029 | - | let fundingPayment = $ | |
1008 | + | let $t04356043671 = getPosition(_trader) | |
1009 | + | let positionSize = $t04356043671._1 | |
1010 | + | let positionMargin = $t04356043671._2 | |
1011 | + | let pon = $t04356043671._3 | |
1012 | + | let positionLstUpdCPF = $t04356043671._4 | |
1013 | + | let $t04367643777 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT) | |
1014 | + | let positionNotional = $t04367643777._1 | |
1015 | + | let unrealizedPnl = $t04367643777._2 | |
1016 | + | let $t04378243964 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl) | |
1017 | + | let remainMargin = $t04378243964._1 | |
1018 | + | let badDebt = $t04378243964._2 | |
1019 | + | let fundingPayment = $t04378243964._3 | |
1030 | 1020 | throw(((s(remainMargin) + s(fundingPayment)) + s(getMarginRatio(_trader)))) | |
1031 | 1021 | } | |
1032 | 1022 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let k_ora_key = "k_ora_key" | |
5 | 5 | ||
6 | 6 | let k_ora_block_key = "k_ora_block_key" | |
7 | 7 | ||
8 | 8 | let k_ora = "k_ora" | |
9 | 9 | ||
10 | 10 | let k_balance = "k_balance" | |
11 | 11 | ||
12 | 12 | let k_positionSize = "k_positionSize" | |
13 | 13 | ||
14 | 14 | let k_positionMargin = "k_positionMargin" | |
15 | 15 | ||
16 | 16 | let k_positionOpenNotional = "k_positionOpenNotional" | |
17 | 17 | ||
18 | 18 | let k_positionLastUpdatedCumulativePremiumFraction = "k_positionFraction" | |
19 | 19 | ||
20 | 20 | let k_initialized = "k_initialized" | |
21 | 21 | ||
22 | 22 | let k_paused = "k_paused" | |
23 | 23 | ||
24 | 24 | let k_fee = "k_fee" | |
25 | 25 | ||
26 | 26 | let k_fundingPeriod = "k_fundingPeriod" | |
27 | 27 | ||
28 | 28 | let k_initMarginRatio = "k_initMarginRatio" | |
29 | 29 | ||
30 | 30 | let k_maintenanceMarginRatio = "k_mmr" | |
31 | 31 | ||
32 | 32 | let k_liquidationFeeRatio = "k_liquidationFeeRatio" | |
33 | 33 | ||
34 | 34 | let k_spreadLimit = "k_spreadLimit" | |
35 | 35 | ||
36 | 36 | let k_maxPriceImpact = "k_maxPriceImpact" | |
37 | 37 | ||
38 | 38 | let k_lastDataStr = "k_lastDataStr" | |
39 | 39 | ||
40 | 40 | let k_lastMinuteId = "k_lastMinuteId" | |
41 | 41 | ||
42 | 42 | let k_twapDataLastCumulativePrice = "k_twapDataLastCumulativePrice" | |
43 | 43 | ||
44 | 44 | let k_twapDataLastPrice = "k_twapDataLastPrice" | |
45 | 45 | ||
46 | 46 | let k_latestLongCumulativePremiumFraction = "k_latestLongPremiumFraction" | |
47 | 47 | ||
48 | 48 | let k_latestShortCumulativePremiumFraction = "k_latestShortPremiumFraction" | |
49 | 49 | ||
50 | 50 | let k_nextFundingBlock = "k_nextFundingBlockMinTimestamp" | |
51 | 51 | ||
52 | 52 | let k_longFundingRate = "k_longFundingRate" | |
53 | 53 | ||
54 | 54 | let k_shortFundingRate = "k_shortFundingRate" | |
55 | 55 | ||
56 | 56 | let k_quoteAssetReserve = "k_qtAstR" | |
57 | 57 | ||
58 | 58 | let k_baseAssetReserve = "k_bsAstR" | |
59 | 59 | ||
60 | 60 | let k_totalPositionSize = "k_totalPositionSize" | |
61 | 61 | ||
62 | 62 | let k_totalLongPositionSize = "k_totalLongPositionSize" | |
63 | 63 | ||
64 | 64 | let k_totalShortPositionSize = "k_totalShortPositionSize" | |
65 | 65 | ||
66 | 66 | let k_cumulativeNotional = "k_cumulativeNotional" | |
67 | 67 | ||
68 | 68 | let k_openInterestNotional = "k_openInterestNotional" | |
69 | 69 | ||
70 | 70 | let k_coordinatorAddress = "k_coordinatorAddress" | |
71 | 71 | ||
72 | 72 | let k_insurance_address = "k_insurance_address" | |
73 | 73 | ||
74 | 74 | let k_admin_address = "k_admin_address" | |
75 | 75 | ||
76 | 76 | let k_admin_public_key = "k_admin_public_key" | |
77 | 77 | ||
78 | 78 | let k_quote_asset = "k_quote_asset" | |
79 | 79 | ||
80 | 80 | let k_quote_staking = "k_quote_staking" | |
81 | 81 | ||
82 | 82 | let k_staking_address = "k_staking_address" | |
83 | 83 | ||
84 | 84 | func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set") | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address)) | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func adminPublicKey () = fromBase58String(getStringValue(coordinator(), k_admin_public_key)) | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset)) | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func quoteAssetStaking () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_quote_staking)), "Quote asset staking not set") | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), "Insurance not set") | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func insuranceAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_insurance_address)), "Insurance not set") | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | let DIR_LONG = 1 | |
106 | 106 | ||
107 | 107 | let DIR_SHORT = 2 | |
108 | 108 | ||
109 | 109 | let FUNDING_BLOCK_INTERVAL = 60 | |
110 | 110 | ||
111 | 111 | let TWAP_INTERVAL = 15 | |
112 | 112 | ||
113 | 113 | let ORACLE_INTERVAL = 15 | |
114 | 114 | ||
115 | 115 | let SECONDS = 1000 | |
116 | 116 | ||
117 | 117 | let DECIMAL_UNIT = (1 * (((((10 * 10) * 10) * 10) * 10) * 10)) | |
118 | 118 | ||
119 | 119 | let HUNDRED_PERCENT = (100 * DECIMAL_UNIT) | |
120 | 120 | ||
121 | 121 | let ONE_DAY = (86400 * DECIMAL_UNIT) | |
122 | 122 | ||
123 | 123 | let ALL_FEES = 100 | |
124 | 124 | ||
125 | 125 | let PNL_OPTION_SPOT = 1 | |
126 | 126 | ||
127 | 127 | let PNL_OPTION_ORACLE = 2 | |
128 | 128 | ||
129 | 129 | func s (_x) = (toString(_x) + ",") | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN) | |
133 | 133 | ||
134 | 134 | ||
135 | 135 | func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN) | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | func abs (_x) = if ((_x > 0)) | |
139 | 139 | then _x | |
140 | 140 | else -(_x) | |
141 | 141 | ||
142 | 142 | ||
143 | 143 | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
144 | 144 | ||
145 | 145 | ||
146 | 146 | func int (k) = valueOrErrorMessage(getInteger(this, k), ("no value for " + k)) | |
147 | 147 | ||
148 | 148 | ||
149 | 149 | func cbalance () = int(k_balance) | |
150 | 150 | ||
151 | 151 | ||
152 | 152 | func fee () = int(k_fee) | |
153 | 153 | ||
154 | 154 | ||
155 | 155 | func initMarginRatio () = int(k_initMarginRatio) | |
156 | 156 | ||
157 | 157 | ||
158 | 158 | func qtAstR () = int(k_quoteAssetReserve) | |
159 | 159 | ||
160 | 160 | ||
161 | 161 | func bsAstR () = int(k_baseAssetReserve) | |
162 | 162 | ||
163 | 163 | ||
164 | 164 | func totalPositionSize () = int(k_totalPositionSize) | |
165 | 165 | ||
166 | 166 | ||
167 | 167 | func cumulativeNotional () = int(k_cumulativeNotional) | |
168 | 168 | ||
169 | 169 | ||
170 | 170 | func openInterestNotional () = int(k_openInterestNotional) | |
171 | 171 | ||
172 | 172 | ||
173 | 173 | func nextFundingBlockTimestamp () = int(k_nextFundingBlock) | |
174 | 174 | ||
175 | 175 | ||
176 | 176 | func fundingPeriodRaw () = int(k_fundingPeriod) | |
177 | 177 | ||
178 | 178 | ||
179 | 179 | func fundingPeriodDecimal () = (fundingPeriodRaw() * DECIMAL_UNIT) | |
180 | 180 | ||
181 | 181 | ||
182 | 182 | func fundingPeriodSeconds () = (fundingPeriodRaw() * SECONDS) | |
183 | 183 | ||
184 | 184 | ||
185 | 185 | func maintenanceMarginRatio () = int(k_maintenanceMarginRatio) | |
186 | 186 | ||
187 | 187 | ||
188 | 188 | func liquidationFeeRatio () = int(k_liquidationFeeRatio) | |
189 | 189 | ||
190 | 190 | ||
191 | 191 | func spreadLimit () = int(k_spreadLimit) | |
192 | 192 | ||
193 | 193 | ||
194 | 194 | func maxPriceImpact () = int(k_maxPriceImpact) | |
195 | 195 | ||
196 | 196 | ||
197 | 197 | func latestLongCumulativePremiumFraction () = int(k_latestLongCumulativePremiumFraction) | |
198 | 198 | ||
199 | 199 | ||
200 | 200 | func latestShortCumulativePremiumFraction () = int(k_latestShortCumulativePremiumFraction) | |
201 | 201 | ||
202 | 202 | ||
203 | 203 | func totalShortPositionSize () = int(k_totalShortPositionSize) | |
204 | 204 | ||
205 | 205 | ||
206 | 206 | func totalLongPositionSize () = int(k_totalLongPositionSize) | |
207 | 207 | ||
208 | 208 | ||
209 | 209 | func requireMoreMarginRatio (_marginRatio,_baseMarginRatio,_largerThanOrEqualTo) = { | |
210 | 210 | let remainingMarginRatio = (_marginRatio - _baseMarginRatio) | |
211 | 211 | if (if (_largerThanOrEqualTo) | |
212 | 212 | then (0 > remainingMarginRatio) | |
213 | 213 | else false) | |
214 | 214 | then throw("Invalid margin") | |
215 | 215 | else if (if (!(_largerThanOrEqualTo)) | |
216 | 216 | then (remainingMarginRatio >= 0) | |
217 | 217 | else false) | |
218 | 218 | then throw("Invalid margin") | |
219 | 219 | else true | |
220 | 220 | } | |
221 | 221 | ||
222 | 222 | ||
223 | 223 | func latestCumulativePremiumFraction (_positionSize) = if ((_positionSize == 0)) | |
224 | 224 | then throw("Should not be called with _positionSize == 0") | |
225 | 225 | else if ((_positionSize > 0)) | |
226 | 226 | then latestLongCumulativePremiumFraction() | |
227 | 227 | else latestShortCumulativePremiumFraction() | |
228 | 228 | ||
229 | 229 | ||
230 | 230 | func getPosition (_trader) = { | |
231 | 231 | let positionSizeOpt = getInteger(this, toCompositeKey(k_positionSize, _trader)) | |
232 | 232 | match positionSizeOpt { | |
233 | 233 | case positionSize: Int => | |
234 | 234 | $Tuple4(positionSize, getIntegerValue(this, toCompositeKey(k_positionMargin, _trader)), getIntegerValue(this, toCompositeKey(k_positionOpenNotional, _trader)), getIntegerValue(this, toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _trader))) | |
235 | 235 | case _ => | |
236 | 236 | $Tuple4(0, 0, 0, 0) | |
237 | 237 | } | |
238 | 238 | } | |
239 | 239 | ||
240 | 240 | ||
241 | 241 | func requireOpenPosition (_trader) = if ((getPosition(_trader)._1 == 0)) | |
242 | 242 | then throw("No open position") | |
243 | 243 | else true | |
244 | 244 | ||
245 | 245 | ||
246 | 246 | func initialized () = valueOrElse(getBoolean(this, k_initialized), false) | |
247 | 247 | ||
248 | 248 | ||
249 | 249 | func paused () = valueOrElse(getBoolean(this, k_paused), false) | |
250 | 250 | ||
251 | 251 | ||
252 | 252 | func updateReserve (_isAdd,_quoteAssetAmount,_baseAssetAmount) = if (_isAdd) | |
253 | 253 | then { | |
254 | 254 | let newBase = (bsAstR() - _baseAssetAmount) | |
255 | 255 | if ((0 >= newBase)) | |
256 | 256 | then throw("Tx lead to base asset reserve <= 0, revert") | |
257 | 257 | else $Tuple4((qtAstR() + _quoteAssetAmount), newBase, (totalPositionSize() + _baseAssetAmount), (cumulativeNotional() + _quoteAssetAmount)) | |
258 | 258 | } | |
259 | 259 | else { | |
260 | 260 | let newQuote = (qtAstR() - _quoteAssetAmount) | |
261 | 261 | if ((0 >= newQuote)) | |
262 | 262 | then throw("Tx lead to base quote reserve <= 0, revert") | |
263 | 263 | else $Tuple4(newQuote, (bsAstR() + _baseAssetAmount), (totalPositionSize() - _baseAssetAmount), (cumulativeNotional() - _quoteAssetAmount)) | |
264 | 264 | } | |
265 | 265 | ||
266 | 266 | ||
267 | 267 | func swapInput (_isAdd,_quoteAssetAmount) = { | |
268 | 268 | let _qtAstR = qtAstR() | |
269 | 269 | let _bsAstR = bsAstR() | |
270 | 270 | let priceBefore = divd(_qtAstR, _bsAstR) | |
271 | 271 | let amountBaseAssetBoughtWithoutPriceImpact = muld(_quoteAssetAmount, priceBefore) | |
272 | 272 | let k = muld(_qtAstR, _bsAstR) | |
273 | 273 | let quoteAssetReserveAfter = if (_isAdd) | |
274 | 274 | then (_qtAstR + _quoteAssetAmount) | |
275 | 275 | else (_qtAstR - _quoteAssetAmount) | |
276 | 276 | let baseAssetReserveAfter = divd(k, quoteAssetReserveAfter) | |
277 | 277 | let amountBaseAssetBoughtAbs = abs((baseAssetReserveAfter - _bsAstR)) | |
278 | 278 | let amountBaseAssetBought = if (_isAdd) | |
279 | 279 | then amountBaseAssetBoughtAbs | |
280 | 280 | else -(amountBaseAssetBoughtAbs) | |
281 | 281 | let priceImpact = ((amountBaseAssetBoughtWithoutPriceImpact - amountBaseAssetBoughtAbs) / amountBaseAssetBoughtWithoutPriceImpact) | |
282 | 282 | let maxPriceImpactValue = maxPriceImpact() | |
283 | 283 | if ((priceImpact > maxPriceImpactValue)) | |
284 | 284 | then throw(((("Price impact " + toString(priceImpact)) + " > max price impact ") + toString(maxPriceImpactValue))) | |
285 | 285 | else { | |
286 | 286 | let $t01143211635 = updateReserve(_isAdd, _quoteAssetAmount, amountBaseAssetBoughtAbs) | |
287 | 287 | let quoteAssetReserveAfter1 = $t01143211635._1 | |
288 | 288 | let baseAssetReserveAfter1 = $t01143211635._2 | |
289 | 289 | let totalPositionSizeAfter1 = $t01143211635._3 | |
290 | 290 | let cumulativeNotionalAfter1 = $t01143211635._4 | |
291 | 291 | $Tuple5(amountBaseAssetBought, quoteAssetReserveAfter1, baseAssetReserveAfter1, totalPositionSizeAfter1, cumulativeNotionalAfter1) | |
292 | 292 | } | |
293 | 293 | } | |
294 | 294 | ||
295 | 295 | ||
296 | 296 | func calcRemainMarginWithFundingPayment (_oldPositionSize,_oldPositionMargin,_oldPositionCumulativePremiumFraction,_marginDelta) = { | |
297 | 297 | let fundingPayment = if ((_oldPositionSize != 0)) | |
298 | 298 | then { | |
299 | 299 | let _latestCumulativePremiumFraction = latestCumulativePremiumFraction(_oldPositionSize) | |
300 | 300 | muld((_latestCumulativePremiumFraction - _oldPositionCumulativePremiumFraction), _oldPositionSize) | |
301 | 301 | } | |
302 | 302 | else 0 | |
303 | 303 | let signedMargin = ((_marginDelta - fundingPayment) + _oldPositionMargin) | |
304 | 304 | let $t01238212509 = if ((0 > signedMargin)) | |
305 | 305 | then $Tuple2(0, abs(signedMargin)) | |
306 | 306 | else $Tuple2(abs(signedMargin), 0) | |
307 | 307 | let remainMargin = $t01238212509._1 | |
308 | 308 | let badDebt = $t01238212509._2 | |
309 | 309 | $Tuple3(remainMargin, badDebt, fundingPayment) | |
310 | 310 | } | |
311 | 311 | ||
312 | 312 | ||
313 | 313 | func swapOutput (_isAdd,_baseAssetAmount) = { | |
314 | 314 | let _quoteAssetReserve = qtAstR() | |
315 | 315 | let _baseAssetReserve = bsAstR() | |
316 | 316 | if ((_baseAssetAmount == 0)) | |
317 | 317 | then throw("Invalid base asset amount") | |
318 | 318 | else { | |
319 | 319 | let k = muld(_quoteAssetReserve, _baseAssetReserve) | |
320 | 320 | let baseAssetPoolAmountAfter = if (_isAdd) | |
321 | 321 | then (_baseAssetReserve + _baseAssetAmount) | |
322 | 322 | else (_baseAssetReserve - _baseAssetAmount) | |
323 | 323 | let quoteAssetAfter = divd(k, baseAssetPoolAmountAfter) | |
324 | 324 | let quoteAssetSold = abs((quoteAssetAfter - _quoteAssetReserve)) | |
325 | 325 | let $t01334713540 = updateReserve(!(_isAdd), quoteAssetSold, _baseAssetAmount) | |
326 | 326 | let quoteAssetReserveAfter1 = $t01334713540._1 | |
327 | 327 | let baseAssetReserveAfter1 = $t01334713540._2 | |
328 | 328 | let totalPositionSizeAfter1 = $t01334713540._3 | |
329 | 329 | let cumulativeNotionalAfter1 = $t01334713540._4 | |
330 | 330 | $Tuple7(quoteAssetSold, quoteAssetReserveAfter1, baseAssetReserveAfter1, totalPositionSizeAfter1, cumulativeNotionalAfter1, (totalLongPositionSize() - (if (_isAdd) | |
331 | 331 | then abs(_baseAssetAmount) | |
332 | 332 | else 0)), (totalShortPositionSize() - (if (!(_isAdd)) | |
333 | 333 | then abs(_baseAssetAmount) | |
334 | 334 | else 0))) | |
335 | 335 | } | |
336 | 336 | } | |
337 | 337 | ||
338 | 338 | ||
339 | 339 | func getOracleTwapPrice () = { | |
340 | 340 | let oracle = valueOrErrorMessage(addressFromString(getStringValue(this, k_ora)), "") | |
341 | 341 | let priceKey = getStringValue(this, k_ora_key) | |
342 | 342 | let blockKey = getStringValue(this, k_ora_block_key) | |
343 | 343 | let lastValue = getIntegerValue(oracle, priceKey) | |
344 | 344 | lastValue | |
345 | 345 | } | |
346 | 346 | ||
347 | 347 | ||
348 | 348 | func getSpotPrice () = { | |
349 | 349 | let _quoteAssetReserve = qtAstR() | |
350 | 350 | let _baseAssetReserve = bsAstR() | |
351 | 351 | divd(_quoteAssetReserve, _baseAssetReserve) | |
352 | 352 | } | |
353 | 353 | ||
354 | 354 | ||
355 | 355 | func isOverFluctuationLimit () = { | |
356 | 356 | let oraclePrice = getOracleTwapPrice() | |
357 | 357 | let currentPrice = getSpotPrice() | |
358 | 358 | (divd(abs((oraclePrice - currentPrice)), oraclePrice) > spreadLimit()) | |
359 | 359 | } | |
360 | 360 | ||
361 | 361 | ||
362 | 362 | func getPositionNotionalAndUnrealizedPnl (_trader,_option) = { | |
363 | 363 | let $t01517215300 = getPosition(_trader) | |
364 | 364 | let positionSize = $t01517215300._1 | |
365 | 365 | let positionMargin = $t01517215300._2 | |
366 | 366 | let positionOpenNotional = $t01517215300._3 | |
367 | 367 | let positionLstUpdCPF = $t01517215300._4 | |
368 | 368 | let positionSizeAbs = abs(positionSize) | |
369 | 369 | if ((positionSizeAbs == 0)) | |
370 | 370 | then throw("Invalid position size") | |
371 | 371 | else { | |
372 | 372 | let isShort = (0 > positionSize) | |
373 | 373 | let positionNotional = if ((_option == PNL_OPTION_SPOT)) | |
374 | 374 | then { | |
375 | 375 | let $t01554715654 = swapOutput(!(isShort), positionSizeAbs) | |
376 | 376 | let outPositionNotional = $t01554715654._1 | |
377 | 377 | let x1 = $t01554715654._2 | |
378 | 378 | let x2 = $t01554715654._3 | |
379 | 379 | let x3 = $t01554715654._4 | |
380 | 380 | outPositionNotional | |
381 | 381 | } | |
382 | 382 | else (positionSizeAbs * getOracleTwapPrice()) | |
383 | 383 | let unrealizedPnl = if (isShort) | |
384 | 384 | then (positionOpenNotional - positionNotional) | |
385 | 385 | else (positionNotional - positionOpenNotional) | |
386 | 386 | $Tuple2(positionNotional, unrealizedPnl) | |
387 | 387 | } | |
388 | 388 | } | |
389 | 389 | ||
390 | 390 | ||
391 | 391 | func getMarginRatioByOption (_trader,_option) = { | |
392 | 392 | let $t01614916260 = getPosition(_trader) | |
393 | 393 | let positionSize = $t01614916260._1 | |
394 | 394 | let positionMargin = $t01614916260._2 | |
395 | 395 | let pon = $t01614916260._3 | |
396 | 396 | let positionLstUpdCPF = $t01614916260._4 | |
397 | 397 | let $t01626616359 = getPositionNotionalAndUnrealizedPnl(_trader, _option) | |
398 | 398 | let positionNotional = $t01626616359._1 | |
399 | 399 | let unrealizedPnl = $t01626616359._2 | |
400 | 400 | let $t01636416530 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl) | |
401 | 401 | let remainMargin = $t01636416530._1 | |
402 | 402 | let badDebt = $t01636416530._2 | |
403 | 403 | divd((remainMargin - badDebt), positionNotional) | |
404 | 404 | } | |
405 | 405 | ||
406 | 406 | ||
407 | 407 | func getMarginRatio (_trader) = getMarginRatioByOption(_trader, PNL_OPTION_SPOT) | |
408 | 408 | ||
409 | 409 | ||
410 | 410 | func internalClosePosition (_trader) = { | |
411 | 411 | let $t01683616947 = getPosition(_trader) | |
412 | 412 | let positionSize = $t01683616947._1 | |
413 | 413 | let positionMargin = $t01683616947._2 | |
414 | 414 | let pon = $t01683616947._3 | |
415 | 415 | let positionLstUpdCPF = $t01683616947._4 | |
416 | 416 | let $t01695317040 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT) | |
417 | 417 | let x1 = $t01695317040._1 | |
418 | 418 | let unrealizedPnl = $t01695317040._2 | |
419 | 419 | let $t01704517213 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl) | |
420 | 420 | let remainMargin = $t01704517213._1 | |
421 | 421 | let badDebt = $t01704517213._2 | |
422 | 422 | let exchangedPositionSize = -(positionSize) | |
423 | 423 | let realizedPnl = unrealizedPnl | |
424 | 424 | let marginToVault = -(remainMargin) | |
425 | 425 | let $t01734017621 = swapOutput((positionSize > 0), abs(positionSize)) | |
426 | 426 | let exchangedQuoteAssetAmount = $t01734017621._1 | |
427 | 427 | let quoteAssetReserveAfter = $t01734017621._2 | |
428 | 428 | let baseAssetReserveAfter = $t01734017621._3 | |
429 | 429 | let totalPositionSizeAfter = $t01734017621._4 | |
430 | 430 | let cumulativeNotionalAfter = $t01734017621._5 | |
431 | 431 | let totalLongAfter = $t01734017621._6 | |
432 | 432 | let totalShortAfter = $t01734017621._7 | |
433 | 433 | let openInterestNotionalAfter = (openInterestNotional() - pon) | |
434 | 434 | $Tuple12(exchangedPositionSize, badDebt, realizedPnl, marginToVault, quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInterestNotionalAfter, exchangedQuoteAssetAmount, totalLongAfter, totalShortAfter) | |
435 | 435 | } | |
436 | 436 | ||
437 | 437 | ||
438 | 438 | func getTwapSpotPrice () = { | |
439 | 439 | let minuteId = ((lastBlock.timestamp / 1000) / 60) | |
440 | 440 | let startMinuteId = (minuteId - TWAP_INTERVAL) | |
441 | 441 | let listStr = valueOrElse(getString(this, k_lastDataStr), "") | |
442 | 442 | let list = split(listStr, ",") | |
443 | 443 | func filterFn (accumulator,next) = if ((startMinuteId >= parseIntValue(next))) | |
444 | 444 | then (accumulator :+ parseIntValue(next)) | |
445 | 445 | else accumulator | |
446 | 446 | ||
447 | 447 | let listF = { | |
448 | 448 | let $l = list | |
449 | 449 | let $s = size($l) | |
450 | 450 | let $acc0 = nil | |
451 | 451 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
452 | 452 | then $a | |
453 | 453 | else filterFn($a, $l[$i]) | |
454 | 454 | ||
455 | 455 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
456 | 456 | then $a | |
457 | 457 | else throw("List size exceeds 20") | |
458 | 458 | ||
459 | 459 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
460 | 460 | } | |
461 | 461 | let maxIndex = if ((size(listF) > 0)) | |
462 | 462 | then max(listF) | |
463 | 463 | else parseIntValue(list[0]) | |
464 | 464 | let lastMinuteId = valueOrElse(getInteger(this, k_lastMinuteId), 0) | |
465 | 465 | let endLastCumulativePrice = valueOrElse(getInteger(this, ((k_twapDataLastCumulativePrice + "_") + toString(lastMinuteId))), 0) | |
466 | 466 | let endLastPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(lastMinuteId))), 0) | |
467 | 467 | let nowCumulativePrice = (endLastCumulativePrice + ((minuteId - lastMinuteId) * endLastPrice)) | |
468 | 468 | let startLastCumulativePrice = valueOrElse(getInteger(this, ((k_twapDataLastCumulativePrice + "_") + toString(maxIndex))), 0) | |
469 | 469 | let startLastPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(maxIndex))), 0) | |
470 | 470 | let startCumulativePrice = (startLastCumulativePrice + ((startMinuteId - maxIndex) * startLastPrice)) | |
471 | 471 | ((nowCumulativePrice - startCumulativePrice) / TWAP_INTERVAL) | |
472 | 472 | } | |
473 | 473 | ||
474 | 474 | ||
475 | 475 | func updateSettings (_initMarginRatio,_mmr,_liquidationFeeRatio,_fundingPeriod,_fee,_spreadLimit,_maxPriceImpact) = [IntegerEntry(k_initMarginRatio, _initMarginRatio), IntegerEntry(k_maintenanceMarginRatio, _mmr), IntegerEntry(k_liquidationFeeRatio, _liquidationFeeRatio), IntegerEntry(k_fundingPeriod, _fundingPeriod), IntegerEntry(k_fee, _fee), IntegerEntry(k_spreadLimit, _spreadLimit), IntegerEntry(k_maxPriceImpact, _maxPriceImpact)] | |
476 | 476 | ||
477 | 477 | ||
478 | 478 | func updateFunding (_nextFundingBlock,_latestLongCumulativePremiumFraction,_latestShortCumulativePremiumFraction,_longFundingRate,_shortFundingRate) = [IntegerEntry(k_nextFundingBlock, _nextFundingBlock), IntegerEntry(k_latestLongCumulativePremiumFraction, _latestLongCumulativePremiumFraction), IntegerEntry(k_latestShortCumulativePremiumFraction, _latestShortCumulativePremiumFraction), IntegerEntry(k_longFundingRate, _longFundingRate), IntegerEntry(k_shortFundingRate, _shortFundingRate)] | |
479 | 479 | ||
480 | 480 | ||
481 | 481 | func updatePosition (_address,_size,_margin,_openNotional,_latestCumulativePremiumFraction) = [IntegerEntry(toCompositeKey(k_positionSize, _address), _size), IntegerEntry(toCompositeKey(k_positionMargin, _address), _margin), IntegerEntry(toCompositeKey(k_positionOpenNotional, _address), _openNotional), IntegerEntry(toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _address), _latestCumulativePremiumFraction)] | |
482 | 482 | ||
483 | 483 | ||
484 | 484 | func appendTwap (price) = { | |
485 | 485 | let minuteId = ((lastBlock.timestamp / 1000) / 60) | |
486 | 486 | let previousMinuteId = valueOrElse(getInteger(this, k_lastMinuteId), 0) | |
487 | 487 | if ((previousMinuteId > minuteId)) | |
488 | 488 | then throw("TWAP out-of-order") | |
489 | 489 | else { | |
490 | 490 | let lastMinuteId = if ((previousMinuteId == 0)) | |
491 | 491 | then minuteId | |
492 | 492 | else previousMinuteId | |
493 | 493 | let listStr = valueOrElse(getString(this, k_lastDataStr), "") | |
494 | 494 | let oldList = split(listStr, ",") | |
495 | 495 | let list = if ((size(oldList) > TWAP_INTERVAL)) | |
496 | 496 | then (removeByIndex(oldList, 0) :+ toString(minuteId)) | |
497 | 497 | else (oldList :+ toString(minuteId)) | |
498 | 498 | let prevCumulativePrice = valueOrElse(getInteger(this, ((k_twapDataLastCumulativePrice + "_") + toString(previousMinuteId))), 0) | |
499 | 499 | let prevPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(previousMinuteId))), price) | |
500 | 500 | let lastCumulativePrice = (prevCumulativePrice + ((minuteId - lastMinuteId) * prevPrice)) | |
501 | 501 | func join (accumulator,val) = ((accumulator + val) + ",") | |
502 | 502 | ||
503 | 503 | let newListStr = { | |
504 | 504 | let $l = list | |
505 | 505 | let $s = size($l) | |
506 | 506 | let $acc0 = "" | |
507 | 507 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
508 | 508 | then $a | |
509 | 509 | else join($a, $l[$i]) | |
510 | 510 | ||
511 | 511 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
512 | 512 | then $a | |
513 | 513 | else throw("List size exceeds 20") | |
514 | 514 | ||
515 | 515 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
516 | 516 | } | |
517 | 517 | let newListStrU = dropRight(newListStr, 1) | |
518 | 518 | let newListStrR = if ((take(newListStrU, 1) == ",")) | |
519 | 519 | then drop(newListStrU, 1) | |
520 | 520 | else newListStrU | |
521 | 521 | [IntegerEntry(((k_twapDataLastCumulativePrice + "_") + toString(minuteId)), lastCumulativePrice), IntegerEntry(((k_twapDataLastPrice + "_") + toString(minuteId)), price), IntegerEntry(k_lastMinuteId, minuteId), StringEntry(k_lastDataStr, newListStrR)] | |
522 | 522 | } | |
523 | 523 | } | |
524 | 524 | ||
525 | 525 | ||
526 | 526 | func updateAmm (_qtAstR,_bsAstR,_totalPositionSizeAfter,_cumulativeNotionalAfter,_openInterestNotional,_totalLongPositionSize,_totalShortPositionSize) = if (((_totalLongPositionSize - _totalShortPositionSize) != _totalPositionSizeAfter)) | |
527 | 527 | then throw(((((("Invalid AMM state data: " + toString(_totalLongPositionSize)) + " + ") + toString(_totalShortPositionSize)) + " != ") + toString(_totalPositionSizeAfter))) | |
528 | 528 | else ([IntegerEntry(k_quoteAssetReserve, _qtAstR), IntegerEntry(k_baseAssetReserve, _bsAstR), IntegerEntry(k_totalPositionSize, _totalPositionSizeAfter), IntegerEntry(k_cumulativeNotional, _cumulativeNotionalAfter), IntegerEntry(k_openInterestNotional, _openInterestNotional), IntegerEntry(k_totalLongPositionSize, _totalLongPositionSize), IntegerEntry(k_totalShortPositionSize, _totalShortPositionSize)] ++ appendTwap(divd(_qtAstR, _bsAstR))) | |
529 | 529 | ||
530 | 530 | ||
531 | 531 | func deletePosition (_address) = [DeleteEntry(toCompositeKey(k_positionSize, _address)), DeleteEntry(toCompositeKey(k_positionMargin, _address)), DeleteEntry(toCompositeKey(k_positionOpenNotional, _address)), DeleteEntry(toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _address))] | |
532 | 532 | ||
533 | 533 | ||
534 | 534 | func withdraw (_address,_amount) = { | |
535 | 535 | let balance = assetBalance(this, quoteAsset()) | |
536 | 536 | if ((_amount > balance)) | |
537 | 537 | then throw(((("Unable to withdraw " + toString(_amount)) + " from contract balance ") + toString(balance))) | |
538 | 538 | else [ScriptTransfer(_address, _amount, quoteAsset())] | |
539 | 539 | } | |
540 | 540 | ||
541 | 541 | ||
542 | 542 | func updateBalance (i) = if ((0 > i)) | |
543 | 543 | then throw("Balance") | |
544 | 544 | else [IntegerEntry(k_balance, i)] | |
545 | 545 | ||
546 | 546 | ||
547 | 547 | func transferFee (i) = [ScriptTransfer(stakingAddress(), i, quoteAsset())] | |
548 | 548 | ||
549 | 549 | ||
550 | 550 | @Callable(i) | |
551 | 551 | func pause () = if ((i.caller != adminAddress())) | |
552 | 552 | then throw("Invalid togglePause params") | |
553 | 553 | else [BooleanEntry(k_paused, true)] | |
554 | 554 | ||
555 | 555 | ||
556 | 556 | ||
557 | 557 | @Callable(i) | |
558 | 558 | func unpause () = if ((i.caller != adminAddress())) | |
559 | 559 | then throw("Invalid togglePause params") | |
560 | 560 | else [BooleanEntry(k_paused, false)] | |
561 | 561 | ||
562 | 562 | ||
563 | 563 | ||
564 | 564 | @Callable(i) | |
565 | 565 | func changeSettings (_initMarginRatio,_mmr,_liquidationFeeRatio,_fundingPeriod,_fee,_spreadLimit,_maxPriceImpact) = if ((i.caller != adminAddress())) | |
566 | 566 | then throw("Invalid changeSettings params") | |
567 | 567 | else updateSettings(_initMarginRatio, _mmr, _liquidationFeeRatio, _fundingPeriod, _fee, _spreadLimit, _maxPriceImpact) | |
568 | 568 | ||
569 | 569 | ||
570 | 570 | ||
571 | 571 | @Callable(i) | |
572 | 572 | func initialize (_qtAstR,_bsAstR,_fundingPeriod,_initMarginRatio,_mmr,_liquidationFeeRatio,_fee,_oracle,_oracleKey,_coordinator,_spreadLimit,_maxPriceImpact) = if (if (if (if (if (if (if (if (if (if ((0 >= _qtAstR)) | |
573 | 573 | then true | |
574 | 574 | else (0 >= _bsAstR)) | |
575 | 575 | then true | |
576 | 576 | else (0 >= _fundingPeriod)) | |
577 | 577 | then true | |
578 | 578 | else (0 >= _initMarginRatio)) | |
579 | 579 | then true | |
580 | 580 | else (0 >= _mmr)) | |
581 | 581 | then true | |
582 | 582 | else (0 >= _liquidationFeeRatio)) | |
583 | 583 | then true | |
584 | 584 | else (0 >= _fee)) | |
585 | 585 | then true | |
586 | 586 | else (0 >= _spreadLimit)) | |
587 | 587 | then true | |
588 | 588 | else (0 >= _maxPriceImpact)) | |
589 | 589 | then true | |
590 | 590 | else initialized()) | |
591 | 591 | then throw("Invalid initialize parameters") | |
592 | 592 | else ((((updateAmm(_qtAstR, _bsAstR, 0, 0, 0, 0, 0) ++ updateSettings(_initMarginRatio, _mmr, _liquidationFeeRatio, _fundingPeriod, _fee, _spreadLimit, _maxPriceImpact)) ++ updateFunding((lastBlock.timestamp + _fundingPeriod), 0, 0, 0, 0)) ++ updateBalance(0)) ++ [BooleanEntry(k_initialized, true), StringEntry(k_ora, _oracle), StringEntry(k_ora_key, _oracleKey), StringEntry(k_coordinatorAddress, _coordinator)]) | |
593 | 593 | ||
594 | 594 | ||
595 | 595 | ||
596 | 596 | @Callable(i) | |
597 | - | func decreasePosition (_direction,_amount,_leverage,_minBaseAssetAmount) = if (if (if (if (if (if (if (if ((_direction != DIR_LONG)) | |
598 | - | then (_direction != DIR_SHORT) | |
599 | - | else false) | |
600 | - | then true | |
601 | - | else (0 >= _amount)) | |
597 | + | func decreasePosition (_amount,_leverage,_minBaseAssetAmount) = if (if (if (if (if (if ((0 >= _amount)) | |
602 | 598 | then true | |
603 | 599 | else if (((1 * DECIMAL_UNIT) > _leverage)) | |
604 | 600 | then true | |
605 | 601 | else (_leverage > (3 * DECIMAL_UNIT))) | |
606 | 602 | then true | |
607 | 603 | else !(initialized())) | |
608 | 604 | then true | |
609 | 605 | else !(requireMoreMarginRatio(divd(DECIMAL_UNIT, _leverage), initMarginRatio(), true))) | |
610 | 606 | then true | |
611 | 607 | else !(requireOpenPosition(toString(i.caller)))) | |
612 | 608 | then true | |
613 | 609 | else paused()) | |
614 | 610 | then throw("Invalid decreasePosition parameters") | |
615 | 611 | else { | |
616 | - | let $ | |
617 | - | let oldPositionSize = $ | |
618 | - | let oldPositionMargin = $ | |
619 | - | let oldPositionOpenNotional = $ | |
620 | - | let oldPositionLstUpdCPF = $ | |
621 | - | let | |
622 | - | then | |
623 | - | else | |
612 | + | let $t02672326875 = getPosition(toString(i.caller)) | |
613 | + | let oldPositionSize = $t02672326875._1 | |
614 | + | let oldPositionMargin = $t02672326875._2 | |
615 | + | let oldPositionOpenNotional = $t02672326875._3 | |
616 | + | let oldPositionLstUpdCPF = $t02672326875._4 | |
617 | + | let _direction = if ((oldPositionSize > 0)) | |
618 | + | then DIR_SHORT | |
619 | + | else DIR_LONG | |
624 | 620 | let isAdd = (_direction == DIR_LONG) | |
625 | - | let $t02713730158 = if (expandExisting) | |
626 | - | then throw("Use increasePosition to open new or increase position") | |
627 | - | else { | |
628 | - | let openNotional = muld(_amount, _leverage) | |
629 | - | let $t02762627742 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT) | |
630 | - | let oldPositionNotional = $t02762627742._1 | |
631 | - | let unrealizedPnl = $t02762627742._2 | |
632 | - | if ((oldPositionNotional > openNotional)) | |
633 | - | then { | |
634 | - | let $t02780428034 = swapInput(isAdd, openNotional) | |
635 | - | let exchangedPositionSize = $t02780428034._1 | |
636 | - | let quoteAssetReserveAfter = $t02780428034._2 | |
637 | - | let baseAssetReserveAfter = $t02780428034._3 | |
638 | - | let totalPositionSizeAfter = $t02780428034._4 | |
639 | - | let cumulativeNotionalAfter = $t02780428034._5 | |
640 | - | let exchangedPositionSizeAbs = abs(exchangedPositionSize) | |
641 | - | if (if ((_minBaseAssetAmount != 0)) | |
642 | - | then (_minBaseAssetAmount > exchangedPositionSizeAbs) | |
643 | - | else false) | |
644 | - | then throw(((("Too little base asset exchanged, got " + toString(exchangedPositionSizeAbs)) + " expected ") + toString(_minBaseAssetAmount))) | |
645 | - | else { | |
646 | - | let realizedPnl = if ((oldPositionSize != 0)) | |
647 | - | then divd(muld(unrealizedPnl, exchangedPositionSizeAbs), oldPositionSize) | |
648 | - | else 0 | |
649 | - | let $t02857428831 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl) | |
650 | - | let remainMargin = $t02857428831._1 | |
651 | - | let badDebt = $t02857428831._2 | |
652 | - | let fundingPayment = $t02857428831._3 | |
653 | - | let exchangedQuoteAssetAmount = openNotional | |
654 | - | let unrealizedPnlAfter = (unrealizedPnl - realizedPnl) | |
655 | - | let remainOpenNotional = if ((oldPositionSize > 0)) | |
656 | - | then ((oldPositionNotional - exchangedQuoteAssetAmount) - unrealizedPnlAfter) | |
657 | - | else ((unrealizedPnlAfter + oldPositionNotional) - exchangedQuoteAssetAmount) | |
658 | - | let newPositionSize = (oldPositionSize + exchangedPositionSize) | |
659 | - | $Tuple11(newPositionSize, remainMargin, abs(remainOpenNotional), latestCumulativePremiumFraction(newPositionSize), baseAssetReserveAfter, quoteAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, (openInterestNotional() - openNotional), (totalLongPositionSize() - (if ((newPositionSize > 0)) | |
660 | - | then abs(exchangedPositionSize) | |
661 | - | else 0)), (totalShortPositionSize() - (if ((0 > newPositionSize)) | |
662 | - | then abs(exchangedPositionSize) | |
663 | - | else 0))) | |
664 | - | } | |
621 | + | let openNotional = muld(_amount, _leverage) | |
622 | + | let $t02704827164 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT) | |
623 | + | let oldPositionNotional = $t02704827164._1 | |
624 | + | let unrealizedPnl = $t02704827164._2 | |
625 | + | let $t02717029804 = if ((oldPositionNotional > openNotional)) | |
626 | + | then { | |
627 | + | let $t02754727766 = swapInput(isAdd, openNotional) | |
628 | + | let exchangedPositionSize = $t02754727766._1 | |
629 | + | let quoteAssetReserveAfter = $t02754727766._2 | |
630 | + | let baseAssetReserveAfter = $t02754727766._3 | |
631 | + | let totalPositionSizeAfter = $t02754727766._4 | |
632 | + | let cumulativeNotionalAfter = $t02754727766._5 | |
633 | + | let exchangedPositionSizeAbs = abs(exchangedPositionSize) | |
634 | + | if (if ((_minBaseAssetAmount != 0)) | |
635 | + | then (_minBaseAssetAmount > exchangedPositionSizeAbs) | |
636 | + | else false) | |
637 | + | then throw(((("Too little base asset exchanged, got " + toString(exchangedPositionSizeAbs)) + " expected ") + toString(_minBaseAssetAmount))) | |
638 | + | else { | |
639 | + | let realizedPnl = if ((oldPositionSize != 0)) | |
640 | + | then divd(muld(unrealizedPnl, exchangedPositionSizeAbs), oldPositionSize) | |
641 | + | else 0 | |
642 | + | let $t02828828533 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl) | |
643 | + | let remainMargin = $t02828828533._1 | |
644 | + | let badDebt = $t02828828533._2 | |
645 | + | let fundingPayment = $t02828828533._3 | |
646 | + | let exchangedQuoteAssetAmount = openNotional | |
647 | + | let unrealizedPnlAfter = (unrealizedPnl - realizedPnl) | |
648 | + | let remainOpenNotional = if ((oldPositionSize > 0)) | |
649 | + | then ((oldPositionNotional - exchangedQuoteAssetAmount) - unrealizedPnlAfter) | |
650 | + | else ((unrealizedPnlAfter + oldPositionNotional) - exchangedQuoteAssetAmount) | |
651 | + | let newPositionSize = (oldPositionSize + exchangedPositionSize) | |
652 | + | $Tuple11(newPositionSize, remainMargin, abs(remainOpenNotional), latestCumulativePremiumFraction(newPositionSize), baseAssetReserveAfter, quoteAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, (openInterestNotional() - openNotional), (totalLongPositionSize() - (if ((newPositionSize > 0)) | |
653 | + | then abs(exchangedPositionSize) | |
654 | + | else 0)), (totalShortPositionSize() - (if ((0 > newPositionSize)) | |
655 | + | then abs(exchangedPositionSize) | |
656 | + | else 0))) | |
665 | 657 | } | |
666 | - | else throw("Close position first") | |
667 | 658 | } | |
668 | - | let newPositionSize = $t02713730158._1 | |
669 | - | let newPositionRemainMargin = $t02713730158._2 | |
670 | - | let newPositionOpenNotional = $t02713730158._3 | |
671 | - | let newPositionLatestCPF = $t02713730158._4 | |
672 | - | let baseAssetReserveAfter = $t02713730158._5 | |
673 | - | let quoteAssetReserveAfter = $t02713730158._6 | |
674 | - | let totalPositionSizeAfter = $t02713730158._7 | |
675 | - | let cumulativeNotionalAfter = $t02713730158._8 | |
676 | - | let openInterestNotionalAfter = $t02713730158._9 | |
677 | - | let totalLongAfter = $t02713730158._10 | |
678 | - | let totalShortAfter = $t02713730158._11 | |
659 | + | else throw("Close position first") | |
660 | + | let newPositionSize = $t02717029804._1 | |
661 | + | let newPositionRemainMargin = $t02717029804._2 | |
662 | + | let newPositionOpenNotional = $t02717029804._3 | |
663 | + | let newPositionLatestCPF = $t02717029804._4 | |
664 | + | let baseAssetReserveAfter = $t02717029804._5 | |
665 | + | let quoteAssetReserveAfter = $t02717029804._6 | |
666 | + | let totalPositionSizeAfter = $t02717029804._7 | |
667 | + | let cumulativeNotionalAfter = $t02717029804._8 | |
668 | + | let openInterestNotionalAfter = $t02717029804._9 | |
669 | + | let totalLongAfter = $t02717029804._10 | |
670 | + | let totalShortAfter = $t02717029804._11 | |
679 | 671 | (updatePosition(toString(i.caller), newPositionSize, newPositionRemainMargin, newPositionOpenNotional, newPositionLatestCPF) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter)) | |
680 | 672 | } | |
681 | 673 | ||
682 | 674 | ||
683 | 675 | ||
684 | 676 | @Callable(i) | |
685 | 677 | func increasePosition (_direction,_leverage,_minBaseAssetAmount) = { | |
686 | 678 | let _rawAmount = i.payments[0].amount | |
687 | 679 | if (if (if (if (if (if (if (if ((_direction != DIR_LONG)) | |
688 | 680 | then (_direction != DIR_SHORT) | |
689 | 681 | else false) | |
690 | 682 | then true | |
691 | 683 | else (0 >= _rawAmount)) | |
692 | 684 | then true | |
693 | 685 | else if (((1 * DECIMAL_UNIT) > _leverage)) | |
694 | 686 | then true | |
695 | 687 | else (_leverage > (3 * DECIMAL_UNIT))) | |
696 | 688 | then true | |
697 | 689 | else !(initialized())) | |
698 | 690 | then true | |
699 | 691 | else (i.payments[0].assetId != quoteAsset())) | |
700 | 692 | then true | |
701 | 693 | else !(requireMoreMarginRatio(divd(DECIMAL_UNIT, _leverage), initMarginRatio(), true))) | |
702 | 694 | then true | |
703 | 695 | else paused()) | |
704 | 696 | then throw("Invalid increasePosition parameters") | |
705 | 697 | else { | |
706 | 698 | let feeAmount = muld(_rawAmount, fee()) | |
707 | 699 | let _amount = (_rawAmount - feeAmount) | |
708 | - | let $t03119431318 = getPosition(toString(i.caller)) | |
709 | - | let oldPositionSize = $t03119431318._1 | |
710 | - | let oldPositionMargin = $t03119431318._2 | |
711 | - | let oldPositionOpenNotional = $t03119431318._3 | |
700 | + | let $t03084030992 = getPosition(toString(i.caller)) | |
701 | + | let oldPositionSize = $t03084030992._1 | |
702 | + | let oldPositionMargin = $t03084030992._2 | |
703 | + | let oldPositionOpenNotional = $t03084030992._3 | |
704 | + | let oldPositionLstUpdCPF = $t03084030992._4 | |
712 | 705 | let isNewPosition = (oldPositionSize == 0) | |
713 | 706 | let isSameDirection = if ((oldPositionSize > 0)) | |
714 | 707 | then (_direction == DIR_LONG) | |
715 | 708 | else (_direction == DIR_SHORT) | |
716 | 709 | let expandExisting = if (!(isNewPosition)) | |
717 | 710 | then isSameDirection | |
718 | 711 | else false | |
719 | 712 | let isAdd = (_direction == DIR_LONG) | |
720 | - | let $ | |
713 | + | let $t03128133670 = if (if (isNewPosition) | |
721 | 714 | then true | |
722 | 715 | else expandExisting) | |
723 | 716 | then { | |
724 | 717 | let openNotional = muld(_amount, _leverage) | |
725 | - | let $ | |
726 | - | let amountBaseAssetBought = $ | |
727 | - | let quoteAssetReserveAfter = $ | |
728 | - | let baseAssetReserveAfter = $ | |
729 | - | let totalPositionSizeAfter = $ | |
730 | - | let cumulativeNotionalAfter = $ | |
718 | + | let $t03170531911 = swapInput(isAdd, openNotional) | |
719 | + | let amountBaseAssetBought = $t03170531911._1 | |
720 | + | let quoteAssetReserveAfter = $t03170531911._2 | |
721 | + | let baseAssetReserveAfter = $t03170531911._3 | |
722 | + | let totalPositionSizeAfter = $t03170531911._4 | |
723 | + | let cumulativeNotionalAfter = $t03170531911._5 | |
731 | 724 | if (if ((_minBaseAssetAmount != 0)) | |
732 | 725 | then (_minBaseAssetAmount > abs(amountBaseAssetBought)) | |
733 | 726 | else false) | |
734 | 727 | then throw(((("Limit error: " + toString(abs(amountBaseAssetBought))) + " < ") + toString(_minBaseAssetAmount))) | |
735 | 728 | else { | |
736 | 729 | let newPositionSize = (oldPositionSize + amountBaseAssetBought) | |
737 | - | let positionLstUpdCPF = if (isNewPosition) | |
738 | - | then latestCumulativePremiumFraction(newPositionSize) | |
739 | - | else getPosition(toString(i.caller))._4 | |
740 | 730 | let increaseMarginRequirement = divd(openNotional, _leverage) | |
741 | - | let $ | |
742 | - | let remainMargin = $ | |
743 | - | let x1 = $ | |
744 | - | let x2 = $ | |
731 | + | let $t03229232531 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, increaseMarginRequirement) | |
732 | + | let remainMargin = $t03229232531._1 | |
733 | + | let x1 = $t03229232531._2 | |
734 | + | let x2 = $t03229232531._3 | |
745 | 735 | $Tuple11(newPositionSize, remainMargin, (oldPositionOpenNotional + openNotional), latestCumulativePremiumFraction(newPositionSize), baseAssetReserveAfter, quoteAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, (openInterestNotional() + openNotional), (totalLongPositionSize() + (if ((newPositionSize > 0)) | |
746 | 736 | then abs(amountBaseAssetBought) | |
747 | 737 | else 0)), (totalShortPositionSize() + (if ((0 > newPositionSize)) | |
748 | 738 | then abs(amountBaseAssetBought) | |
749 | 739 | else 0))) | |
750 | 740 | } | |
751 | 741 | } | |
752 | 742 | else { | |
753 | 743 | let openNotional = muld(_amount, _leverage) | |
754 | - | let $ | |
755 | - | let oldPositionNotional = $ | |
756 | - | let unrealizedPnl = $ | |
744 | + | let $t03336333479 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT) | |
745 | + | let oldPositionNotional = $t03336333479._1 | |
746 | + | let unrealizedPnl = $t03336333479._2 | |
757 | 747 | if ((oldPositionNotional > openNotional)) | |
758 | 748 | then throw("Use decreasePosition to decrease position size") | |
759 | 749 | else throw("Close position first") | |
760 | 750 | } | |
761 | - | let newPositionSize = $ | |
762 | - | let newPositionRemainMargin = $ | |
763 | - | let newPositionOpenNotional = $ | |
764 | - | let newPositionLatestCPF = $ | |
765 | - | let baseAssetReserveAfter = $ | |
766 | - | let quoteAssetReserveAfter = $ | |
767 | - | let totalPositionSizeAfter = $ | |
768 | - | let cumulativeNotionalAfter = $ | |
769 | - | let openInterestNotionalAfter = $ | |
770 | - | let totalLongAfter = $ | |
771 | - | let totalShortAfter = $ | |
751 | + | let newPositionSize = $t03128133670._1 | |
752 | + | let newPositionRemainMargin = $t03128133670._2 | |
753 | + | let newPositionOpenNotional = $t03128133670._3 | |
754 | + | let newPositionLatestCPF = $t03128133670._4 | |
755 | + | let baseAssetReserveAfter = $t03128133670._5 | |
756 | + | let quoteAssetReserveAfter = $t03128133670._6 | |
757 | + | let totalPositionSizeAfter = $t03128133670._7 | |
758 | + | let cumulativeNotionalAfter = $t03128133670._8 | |
759 | + | let openInterestNotionalAfter = $t03128133670._9 | |
760 | + | let totalLongAfter = $t03128133670._10 | |
761 | + | let totalShortAfter = $t03128133670._11 | |
772 | 762 | let feeToStakers = (feeAmount / 2) | |
773 | 763 | let feeToInsurance = (feeAmount - feeToStakers) | |
774 | 764 | let stake = invoke(quoteAssetStaking(), "lockNeutrinoSP", [toString(stakingAddress()), ALL_FEES], [AttachedPayment(quoteAsset(), _amount)]) | |
775 | 765 | if ((stake == stake)) | |
776 | 766 | then { | |
777 | 767 | let depositInsurance = invoke(insuranceAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), feeToInsurance)]) | |
778 | 768 | if ((depositInsurance == depositInsurance)) | |
779 | 769 | then (((updatePosition(toString(i.caller), newPositionSize, newPositionRemainMargin, newPositionOpenNotional, newPositionLatestCPF) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter)) ++ transferFee(feeToStakers)) ++ updateBalance((cbalance() + _amount))) | |
780 | 770 | else throw("Strict value is not equal to itself.") | |
781 | 771 | } | |
782 | 772 | else throw("Strict value is not equal to itself.") | |
783 | 773 | } | |
784 | 774 | } | |
785 | 775 | ||
786 | 776 | ||
787 | 777 | ||
788 | 778 | @Callable(i) | |
789 | 779 | func addMargin () = { | |
790 | 780 | let _rawAmount = i.payments[0].amount | |
791 | 781 | if (if (if (if ((i.payments[0].assetId != quoteAsset())) | |
792 | 782 | then true | |
793 | 783 | else !(requireOpenPosition(toString(i.caller)))) | |
794 | 784 | then true | |
795 | 785 | else !(initialized())) | |
796 | 786 | then true | |
797 | 787 | else paused()) | |
798 | 788 | then throw("Invalid addMargin parameters") | |
799 | 789 | else { | |
800 | 790 | let feeAmount = muld(_rawAmount, fee()) | |
801 | 791 | let _amount = (_rawAmount - feeAmount) | |
802 | - | let $ | |
803 | - | let oldPositionSize = $ | |
804 | - | let oldPositionMargin = $ | |
805 | - | let oldPositionOpenNotional = $ | |
806 | - | let oldPositionLstUpdCPF = $ | |
792 | + | let $t03494635098 = getPosition(toString(i.caller)) | |
793 | + | let oldPositionSize = $t03494635098._1 | |
794 | + | let oldPositionMargin = $t03494635098._2 | |
795 | + | let oldPositionOpenNotional = $t03494635098._3 | |
796 | + | let oldPositionLstUpdCPF = $t03494635098._4 | |
807 | 797 | let feeToStakers = (feeAmount / 2) | |
808 | 798 | let feeToInsurance = (feeAmount - feeToStakers) | |
809 | 799 | let stake = invoke(quoteAssetStaking(), "lockNeutrinoSP", [toString(stakingAddress()), ALL_FEES], [AttachedPayment(quoteAsset(), _amount)]) | |
810 | 800 | if ((stake == stake)) | |
811 | 801 | then { | |
812 | 802 | let depositInsurance = invoke(insuranceAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), feeToInsurance)]) | |
813 | 803 | if ((depositInsurance == depositInsurance)) | |
814 | 804 | then ((updatePosition(toString(i.caller), oldPositionSize, (oldPositionMargin + _amount), oldPositionOpenNotional, oldPositionLstUpdCPF) ++ transferFee(feeToStakers)) ++ updateBalance((cbalance() + _amount))) | |
815 | 805 | else throw("Strict value is not equal to itself.") | |
816 | 806 | } | |
817 | 807 | else throw("Strict value is not equal to itself.") | |
818 | 808 | } | |
819 | 809 | } | |
820 | 810 | ||
821 | 811 | ||
822 | 812 | ||
823 | 813 | @Callable(i) | |
824 | 814 | func removeMargin (_amount) = if (if (if (if ((0 >= _amount)) | |
825 | 815 | then true | |
826 | 816 | else !(requireOpenPosition(toString(i.caller)))) | |
827 | 817 | then true | |
828 | 818 | else !(initialized())) | |
829 | 819 | then true | |
830 | 820 | else paused()) | |
831 | 821 | then throw("Invalid removeMargin parameters") | |
832 | 822 | else { | |
833 | - | let $ | |
834 | - | let oldPositionSize = $ | |
835 | - | let oldPositionMargin = $ | |
836 | - | let oldPositionOpenNotional = $ | |
837 | - | let oldPositionLstUpdCPF = $ | |
823 | + | let $t03601836170 = getPosition(toString(i.caller)) | |
824 | + | let oldPositionSize = $t03601836170._1 | |
825 | + | let oldPositionMargin = $t03601836170._2 | |
826 | + | let oldPositionOpenNotional = $t03601836170._3 | |
827 | + | let oldPositionLstUpdCPF = $t03601836170._4 | |
838 | 828 | let marginDelta = -(_amount) | |
839 | - | let $ | |
840 | - | let remainMargin = $ | |
841 | - | let badDebt = $ | |
829 | + | let $t03620736386 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, marginDelta) | |
830 | + | let remainMargin = $t03620736386._1 | |
831 | + | let badDebt = $t03620736386._2 | |
842 | 832 | if ((badDebt != 0)) | |
843 | 833 | then throw("Invalid added margin amount") | |
844 | 834 | else { | |
845 | 835 | let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [_amount, toBase58String(quoteAsset())], nil) | |
846 | 836 | if ((unstake == unstake)) | |
847 | 837 | then ((updatePosition(toString(i.caller), oldPositionSize, remainMargin, oldPositionOpenNotional, latestCumulativePremiumFraction(oldPositionSize)) ++ withdraw(i.caller, _amount)) ++ updateBalance((cbalance() - _amount))) | |
848 | 838 | else throw("Strict value is not equal to itself.") | |
849 | 839 | } | |
850 | 840 | } | |
851 | 841 | ||
852 | 842 | ||
853 | 843 | ||
854 | 844 | @Callable(i) | |
855 | 845 | func closePosition () = if (if (if (!(requireOpenPosition(toString(i.caller)))) | |
856 | 846 | then true | |
857 | 847 | else !(initialized())) | |
858 | 848 | then true | |
859 | 849 | else paused()) | |
860 | 850 | then throw("Invalid closePosition parameters") | |
861 | 851 | else { | |
862 | - | let $ | |
863 | - | let x1 = $ | |
864 | - | let positionBadDebt = $ | |
865 | - | let realizedPnl = $ | |
866 | - | let marginToVault = $ | |
867 | - | let quoteAssetReserveAfter = $ | |
868 | - | let baseAssetReserveAfter = $ | |
869 | - | let totalPositionSizeAfter = $ | |
870 | - | let cumulativeNotionalAfter = $ | |
871 | - | let openInterestNotionalAfter = $ | |
872 | - | let x2 = $ | |
873 | - | let totalLongAfter = $ | |
874 | - | let totalShortAfter = $ | |
852 | + | let $t03714637530 = internalClosePosition(toString(i.caller)) | |
853 | + | let x1 = $t03714637530._1 | |
854 | + | let positionBadDebt = $t03714637530._2 | |
855 | + | let realizedPnl = $t03714637530._3 | |
856 | + | let marginToVault = $t03714637530._4 | |
857 | + | let quoteAssetReserveAfter = $t03714637530._5 | |
858 | + | let baseAssetReserveAfter = $t03714637530._6 | |
859 | + | let totalPositionSizeAfter = $t03714637530._7 | |
860 | + | let cumulativeNotionalAfter = $t03714637530._8 | |
861 | + | let openInterestNotionalAfter = $t03714637530._9 | |
862 | + | let x2 = $t03714637530._10 | |
863 | + | let totalLongAfter = $t03714637530._11 | |
864 | + | let totalShortAfter = $t03714637530._12 | |
875 | 865 | if ((positionBadDebt > 0)) | |
876 | 866 | then throw("Unable to close position with bad debt") | |
877 | 867 | else { | |
878 | 868 | let withdrawAmount = abs(marginToVault) | |
879 | 869 | let ammBalance = (cbalance() - withdrawAmount) | |
880 | - | let $ | |
870 | + | let $t03773937881 = if ((0 > ammBalance)) | |
881 | 871 | then $Tuple2(0, abs(ammBalance)) | |
882 | 872 | else $Tuple2(ammBalance, 0) | |
883 | - | let ammNewBalance = $ | |
884 | - | let getFromInsurance = $ | |
873 | + | let ammNewBalance = $t03773937881._1 | |
874 | + | let getFromInsurance = $t03773937881._2 | |
885 | 875 | let x = if ((getFromInsurance > 0)) | |
886 | 876 | then { | |
887 | 877 | let withdrawInsurance = invoke(insuranceAddress(), "withdraw", [getFromInsurance], nil) | |
888 | 878 | if ((withdrawInsurance == withdrawInsurance)) | |
889 | 879 | then nil | |
890 | 880 | else throw("Strict value is not equal to itself.") | |
891 | 881 | } | |
892 | 882 | else nil | |
893 | 883 | if ((x == x)) | |
894 | 884 | then { | |
895 | 885 | let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [(withdrawAmount - getFromInsurance), toBase58String(quoteAsset())], nil) | |
896 | 886 | if ((unstake == unstake)) | |
897 | 887 | then (((deletePosition(toString(i.caller)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter)) ++ withdraw(i.caller, withdrawAmount)) ++ updateBalance(ammNewBalance)) | |
898 | 888 | else throw("Strict value is not equal to itself.") | |
899 | 889 | } | |
900 | 890 | else throw("Strict value is not equal to itself.") | |
901 | 891 | } | |
902 | 892 | } | |
903 | 893 | ||
904 | 894 | ||
905 | 895 | ||
906 | 896 | @Callable(i) | |
907 | 897 | func liquidate (_trader) = { | |
908 | 898 | let marginRatio = if (isOverFluctuationLimit()) | |
909 | 899 | then getMarginRatioByOption(_trader, PNL_OPTION_ORACLE) | |
910 | 900 | else getMarginRatioByOption(_trader, PNL_OPTION_SPOT) | |
911 | 901 | if (if (if (if (!(requireMoreMarginRatio(marginRatio, maintenanceMarginRatio(), false))) | |
912 | 902 | then true | |
913 | 903 | else !(requireOpenPosition(_trader))) | |
914 | 904 | then true | |
915 | 905 | else !(initialized())) | |
916 | 906 | then true | |
917 | 907 | else paused()) | |
918 | 908 | then throw("Unable to liquidate") | |
919 | 909 | else { | |
920 | - | let $ | |
921 | - | let x1 = $ | |
922 | - | let badDebt = $ | |
923 | - | let x2 = $ | |
924 | - | let marginToVault = $ | |
925 | - | let quoteAssetReserveAfter = $ | |
926 | - | let baseAssetReserveAfter = $ | |
927 | - | let totalPositionSizeAfter = $ | |
928 | - | let cumulativeNotionalAfter = $ | |
929 | - | let openInterestNotionalAfter = $ | |
930 | - | let exchangedQuoteAssetAmount = $ | |
931 | - | let totalLongAfter = $ | |
932 | - | let totalShortAfter = $ | |
910 | + | let $t03932039747 = internalClosePosition(_trader) | |
911 | + | let x1 = $t03932039747._1 | |
912 | + | let badDebt = $t03932039747._2 | |
913 | + | let x2 = $t03932039747._3 | |
914 | + | let marginToVault = $t03932039747._4 | |
915 | + | let quoteAssetReserveAfter = $t03932039747._5 | |
916 | + | let baseAssetReserveAfter = $t03932039747._6 | |
917 | + | let totalPositionSizeAfter = $t03932039747._7 | |
918 | + | let cumulativeNotionalAfter = $t03932039747._8 | |
919 | + | let openInterestNotionalAfter = $t03932039747._9 | |
920 | + | let exchangedQuoteAssetAmount = $t03932039747._10 | |
921 | + | let totalLongAfter = $t03932039747._11 | |
922 | + | let totalShortAfter = $t03932039747._12 | |
933 | 923 | let liquidationPenalty = muld(exchangedQuoteAssetAmount, liquidationFeeRatio()) | |
934 | 924 | let feeToLiquidator = (liquidationPenalty / 2) | |
935 | 925 | let feeToInsurance = (liquidationPenalty - feeToLiquidator) | |
936 | 926 | let ammBadDebt = (cbalance() - liquidationPenalty) | |
937 | - | let $ | |
927 | + | let $t04014540280 = if ((0 > ammBadDebt)) | |
938 | 928 | then $Tuple2(0, abs(ammBadDebt)) | |
939 | 929 | else $Tuple2(ammBadDebt, 0) | |
940 | - | let newAmmBalance = $ | |
941 | - | let takeFromInsurance = $ | |
930 | + | let newAmmBalance = $t04014540280._1 | |
931 | + | let takeFromInsurance = $t04014540280._2 | |
942 | 932 | let x = if ((takeFromInsurance > 0)) | |
943 | 933 | then { | |
944 | 934 | let withdrawInsurance = invoke(insuranceAddress(), "withdraw", [takeFromInsurance], nil) | |
945 | 935 | if ((withdrawInsurance == withdrawInsurance)) | |
946 | 936 | then nil | |
947 | 937 | else throw("Strict value is not equal to itself.") | |
948 | 938 | } | |
949 | 939 | else nil | |
950 | 940 | if ((x == x)) | |
951 | 941 | then { | |
952 | 942 | let depositInsurance = invoke(insuranceAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), feeToInsurance)]) | |
953 | 943 | if ((depositInsurance == depositInsurance)) | |
954 | 944 | then { | |
955 | 945 | let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [(feeToLiquidator - takeFromInsurance), toBase58String(quoteAsset())], nil) | |
956 | 946 | if ((unstake == unstake)) | |
957 | 947 | then (((deletePosition(_trader) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter)) ++ withdraw(i.caller, feeToLiquidator)) ++ updateBalance(ammBadDebt)) | |
958 | 948 | else throw("Strict value is not equal to itself.") | |
959 | 949 | } | |
960 | 950 | else throw("Strict value is not equal to itself.") | |
961 | 951 | } | |
962 | 952 | else throw("Strict value is not equal to itself.") | |
963 | 953 | } | |
964 | 954 | } | |
965 | 955 | ||
966 | 956 | ||
967 | 957 | ||
968 | 958 | @Callable(i) | |
969 | 959 | func payFunding () = { | |
970 | 960 | let fundingBlockTimestamp = nextFundingBlockTimestamp() | |
971 | 961 | if (if (if ((fundingBlockTimestamp > lastBlock.timestamp)) | |
972 | 962 | then true | |
973 | 963 | else !(initialized())) | |
974 | 964 | then true | |
975 | 965 | else paused()) | |
976 | 966 | then throw(((("Invalid funding block timestamp: " + toString(lastBlock.timestamp)) + " < ") + toString(fundingBlockTimestamp))) | |
977 | 967 | else { | |
978 | 968 | let underlyingPrice = getOracleTwapPrice() | |
979 | 969 | let spotTwapPrice = getTwapSpotPrice() | |
980 | 970 | let premium = (spotTwapPrice - underlyingPrice) | |
981 | - | let $ | |
971 | + | let $t04165042985 = if (if ((totalShortPositionSize() == 0)) | |
982 | 972 | then true | |
983 | 973 | else (totalLongPositionSize() == 0)) | |
984 | 974 | then $Tuple2(0, 0) | |
985 | 975 | else if ((0 > premium)) | |
986 | 976 | then { | |
987 | 977 | let shortPremiumFraction = divd(muld(premium, fundingPeriodDecimal()), ONE_DAY) | |
988 | 978 | let longPremiumFraction = divd(muld(shortPremiumFraction, totalShortPositionSize()), totalLongPositionSize()) | |
989 | 979 | $Tuple2(shortPremiumFraction, longPremiumFraction) | |
990 | 980 | } | |
991 | 981 | else { | |
992 | 982 | let longPremiumFraction = divd(muld(premium, fundingPeriodDecimal()), ONE_DAY) | |
993 | 983 | let shortPremiumFraction = divd(muld(longPremiumFraction, totalLongPositionSize()), totalShortPositionSize()) | |
994 | 984 | $Tuple2(shortPremiumFraction, longPremiumFraction) | |
995 | 985 | } | |
996 | - | let shortPremiumFraction = $ | |
997 | - | let longPremiumFraction = $ | |
986 | + | let shortPremiumFraction = $t04165042985._1 | |
987 | + | let longPremiumFraction = $t04165042985._2 | |
998 | 988 | updateFunding((fundingBlockTimestamp + fundingPeriodSeconds()), (latestLongCumulativePremiumFraction() + longPremiumFraction), (latestShortCumulativePremiumFraction() + shortPremiumFraction), divd(longPremiumFraction, underlyingPrice), divd(shortPremiumFraction, underlyingPrice)) | |
999 | 989 | } | |
1000 | 990 | } | |
1001 | 991 | ||
1002 | 992 | ||
1003 | 993 | ||
1004 | 994 | @Callable(i) | |
1005 | 995 | func v_get (_trader) = { | |
1006 | - | let $ | |
1007 | - | let x1 = $ | |
1008 | - | let x2 = $ | |
1009 | - | let x3 = $ | |
1010 | - | let x4 = $ | |
996 | + | let $t04336043413 = internalClosePosition(_trader) | |
997 | + | let x1 = $t04336043413._1 | |
998 | + | let x2 = $t04336043413._2 | |
999 | + | let x3 = $t04336043413._3 | |
1000 | + | let x4 = $t04336043413._4 | |
1011 | 1001 | throw((((s(x2) + s(x3)) + s(x4)) + s(getMarginRatio(_trader)))) | |
1012 | 1002 | } | |
1013 | 1003 | ||
1014 | 1004 | ||
1015 | 1005 | ||
1016 | 1006 | @Callable(i) | |
1017 | 1007 | func view_calcRemainMarginWithFundingPayment (_trader) = { | |
1018 | - | let $ | |
1019 | - | let positionSize = $ | |
1020 | - | let positionMargin = $ | |
1021 | - | let pon = $ | |
1022 | - | let positionLstUpdCPF = $ | |
1023 | - | let $ | |
1024 | - | let positionNotional = $ | |
1025 | - | let unrealizedPnl = $ | |
1026 | - | let $ | |
1027 | - | let remainMargin = $ | |
1028 | - | let badDebt = $ | |
1029 | - | let fundingPayment = $ | |
1008 | + | let $t04356043671 = getPosition(_trader) | |
1009 | + | let positionSize = $t04356043671._1 | |
1010 | + | let positionMargin = $t04356043671._2 | |
1011 | + | let pon = $t04356043671._3 | |
1012 | + | let positionLstUpdCPF = $t04356043671._4 | |
1013 | + | let $t04367643777 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT) | |
1014 | + | let positionNotional = $t04367643777._1 | |
1015 | + | let unrealizedPnl = $t04367643777._2 | |
1016 | + | let $t04378243964 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl) | |
1017 | + | let remainMargin = $t04378243964._1 | |
1018 | + | let badDebt = $t04378243964._2 | |
1019 | + | let fundingPayment = $t04378243964._3 | |
1030 | 1020 | throw(((s(remainMargin) + s(fundingPayment)) + s(getMarginRatio(_trader)))) | |
1031 | 1021 | } | |
1032 | 1022 | ||
1033 | 1023 | ||
1034 | 1024 | @Verifier(tx) | |
1035 | 1025 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], adminPublicKey()) | |
1036 | 1026 |
github/deemru/w8io/169f3d6 129.10 ms ◑