tx · 78SWcrSAJ4UJ9c5HLKYZGZu9CB7ShxdWBqDWi8jSjvHq 3MuzRcW6fRnqCC76KgKznZP68qsWB1J6shn: -0.07500000 Waves 2023.02.19 14:09 [2456432] smart account 3MuzRcW6fRnqCC76KgKznZP68qsWB1J6shn > SELF 0.00000000 Waves
{ "type": 13, "id": "78SWcrSAJ4UJ9c5HLKYZGZu9CB7ShxdWBqDWi8jSjvHq", "fee": 7500000, "feeAssetId": null, "timestamp": 1676805010430, "version": 2, "chainId": 84, "sender": "3MuzRcW6fRnqCC76KgKznZP68qsWB1J6shn", "senderPublicKey": "EjNbd48ENcnJ4wjBkASdYJHavM8QHrAbFDbJ46ffyUcU", "proofs": [ "5RTe5ZspHRU5HhbBmEhmFoetvg2NRUW2Zx2zeQjzBHg9CxcXt14M2T67TSBfCFwnFEnm78uU2tNxtindd8kvbtAS" ], "script": "base64:BgJ0CAISABIAEgASABIDCgEBEgMKAQESEAoOAQEBAQEBAQEBAQEBAQESFQoTAQEBAQEBAQgICAEBAQEBAQEBARIGCgQBAQEIEgASAwoBARIFCgMBAQQSAwoBCBIAEgASABIDCgEIEgMKAQESABIAEgASBAoCCAi5AQAMa19iYXNlT3JhY2xlAgxrX2Jhc2VPcmFjbGUADWtfcXVvdGVPcmFjbGUCDWtfcXVvdGVPcmFjbGUACWtfYmFsYW5jZQIJa19iYWxhbmNlAAprX3NlcXVlbmNlAgprX3NlcXVlbmNlAA5rX3Bvc2l0aW9uU2l6ZQIOa19wb3NpdGlvblNpemUAEGtfcG9zaXRpb25NYXJnaW4CEGtfcG9zaXRpb25NYXJnaW4AFmtfcG9zaXRpb25PcGVuTm90aW9uYWwCFmtfcG9zaXRpb25PcGVuTm90aW9uYWwALmtfcG9zaXRpb25MYXN0VXBkYXRlZEN1bXVsYXRpdmVQcmVtaXVtRnJhY3Rpb24CEmtfcG9zaXRpb25GcmFjdGlvbgASa19wb3NpdGlvblNlcXVlbmNlAhJrX3Bvc2l0aW9uU2VxdWVuY2UAD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Wx1ZQEFDmNvb3JkaW5hdG9yU3RyBQ9rX2FkbWluX2FkZHJlc3MDCQEJaXNEZWZpbmVkAQUFYWRtaW4JAQt2YWx1ZU9yRWxzZQIJAJsIAgkBEUBleHRyTmF0aXZlKDEwNjIpAQkBBXZhbHVlAQUFYWRtaW4JAKwCAgkArAICCQCsAgICB3N0YXR1c18JAKUIAQUEdGhpcwIBXwkA2AQBCAUCdHgCaWQHCQACAQIudW5hYmxlIHRvIHZlcmlmeTogYWRtaW4gbm90IHNldCBpbiBjb29yZGluYXRvcgkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleWuClq8=", "height": 2456432, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EaEhcyWbSqpTnKwemrq93WxNfUqkNDBew1Gk9oZH8FHp Next: 5ZRYXQTdiyFXSxtvpq1MceAw1Eqf2z6Kd6BWHJB7ZHz1 Diff:
Old | New | Differences | |
---|---|---|---|
58 | 58 | let k_maxOracleDelay = "k_maxOracleDelay" | |
59 | 59 | ||
60 | 60 | let k_fundingMode = "k_fundingMode" | |
61 | - | ||
62 | - | let k_lastDataStr = "k_lastDataStr" | |
63 | - | ||
64 | - | let k_lastMinuteId = "k_lastMinuteId" | |
65 | - | ||
66 | - | let k_twapDataLastCumulativePrice = "k_twapDataLastCumulativePrice" | |
67 | - | ||
68 | - | let k_twapDataLastPrice = "k_twapDataLastPrice" | |
69 | - | ||
70 | - | let k_twapDataPreviousMinuteId = "k_twapDataPreviousMinuteId" | |
71 | 61 | ||
72 | 62 | let k_latestLongCumulativePremiumFraction = "k_latestLongPremiumFraction" | |
73 | 63 | ||
465 | 455 | let amountBaseAssetBought = if (_isAdd) | |
466 | 456 | then amountBaseAssetBoughtAbs | |
467 | 457 | else -(amountBaseAssetBoughtAbs) | |
468 | - | let $ | |
469 | - | let quoteAssetReserveAfter1 = $ | |
470 | - | let baseAssetReserveAfter1 = $ | |
471 | - | let totalPositionSizeAfter1 = $ | |
458 | + | let $t01635216522 = updateReserve(_isAdd, quoteAssetAmountAdjusted, amountBaseAssetBoughtAbs) | |
459 | + | let quoteAssetReserveAfter1 = $t01635216522._1 | |
460 | + | let baseAssetReserveAfter1 = $t01635216522._2 | |
461 | + | let totalPositionSizeAfter1 = $t01635216522._3 | |
472 | 462 | let priceBefore = divd(muld(_qtAstR, _qtAstW), muld(_bsAstR, _bsAstW)) | |
473 | 463 | let marketPrice = divd(_quoteAssetAmount, amountBaseAssetBoughtAbs) | |
474 | 464 | let priceDiff = abs((priceBefore - marketPrice)) | |
496 | 486 | else 0 | |
497 | 487 | let rolloverFee = calcRolloverFee(_oldPositionMargin, _oldPositionLastUpdatedTimestamp) | |
498 | 488 | let signedMargin = (((_marginDelta - rolloverFee) - fundingPayment) + _oldPositionMargin) | |
499 | - | let $ | |
489 | + | let $t01877718904 = if ((0 > signedMargin)) | |
500 | 490 | then $Tuple2(0, abs(signedMargin)) | |
501 | 491 | else $Tuple2(abs(signedMargin), 0) | |
502 | - | let remainMargin = $ | |
503 | - | let badDebt = $ | |
492 | + | let remainMargin = $t01877718904._1 | |
493 | + | let badDebt = $t01877718904._2 | |
504 | 494 | $Tuple4(remainMargin, badDebt, fundingPayment, rolloverFee) | |
505 | 495 | } | |
506 | 496 | ||
518 | 508 | let quoteAssetDelta = abs((quoteAssetAfter - _quoteAssetReserve)) | |
519 | 509 | let quoteAssetSold = muld(quoteAssetDelta, _quoteAssetWeight) | |
520 | 510 | let maxPriceImpactValue = maxPriceImpact() | |
521 | - | let $ | |
522 | - | let quoteAssetReserveAfter1 = $ | |
523 | - | let baseAssetReserveAfter1 = $ | |
524 | - | let totalPositionSizeAfter1 = $ | |
511 | + | let $t02016620328 = updateReserve(!(_isAdd), quoteAssetDelta, _baseAssetAmount) | |
512 | + | let quoteAssetReserveAfter1 = $t02016620328._1 | |
513 | + | let baseAssetReserveAfter1 = $t02016620328._2 | |
514 | + | let totalPositionSizeAfter1 = $t02016620328._3 | |
525 | 515 | let marketPrice = divd(quoteAssetSold, _baseAssetAmount) | |
526 | 516 | let priceDiff = abs((priceBefore - marketPrice)) | |
527 | 517 | let priceImpact = (DECIMAL_UNIT - divd(priceBefore, (priceBefore + priceDiff))) | |
656 | 646 | ||
657 | 647 | ||
658 | 648 | func getPositionNotionalAndUnrealizedPnl (_trader,_option) = { | |
659 | - | let $ | |
660 | - | let positionSize = $ | |
661 | - | let positionMargin = $ | |
662 | - | let positionOpenNotional = $ | |
663 | - | let positionLstUpdCPF = $ | |
649 | + | let $t02820628334 = getPosition(_trader) | |
650 | + | let positionSize = $t02820628334._1 | |
651 | + | let positionMargin = $t02820628334._2 | |
652 | + | let positionOpenNotional = $t02820628334._3 | |
653 | + | let positionLstUpdCPF = $t02820628334._4 | |
664 | 654 | getPositionNotionalAndUnrealizedPnlByValues(positionSize, positionOpenNotional, qtAstR(), qtAstW(), bsAstR(), bsAstW(), _option) | |
665 | 655 | } | |
666 | 656 | ||
669 | 659 | ||
670 | 660 | ||
671 | 661 | func getMarginRatioByOption (_trader,_option) = { | |
672 | - | let $ | |
673 | - | let positionSize = $ | |
674 | - | let positionMargin = $ | |
675 | - | let pon = $ | |
676 | - | let positionLastUpdatedCPF = $ | |
677 | - | let positionTimestamp = $ | |
678 | - | let $ | |
679 | - | let positionNotional = $ | |
680 | - | let unrealizedPnl = $ | |
681 | - | let $ | |
682 | - | let remainMargin = $ | |
683 | - | let badDebt = $ | |
662 | + | let $t02884928990 = getPosition(_trader) | |
663 | + | let positionSize = $t02884928990._1 | |
664 | + | let positionMargin = $t02884928990._2 | |
665 | + | let pon = $t02884928990._3 | |
666 | + | let positionLastUpdatedCPF = $t02884928990._4 | |
667 | + | let positionTimestamp = $t02884928990._5 | |
668 | + | let $t02899629089 = getPositionNotionalAndUnrealizedPnl(_trader, _option) | |
669 | + | let positionNotional = $t02899629089._1 | |
670 | + | let unrealizedPnl = $t02899629089._2 | |
671 | + | let $t02909429306 = calcRemainMarginWithFundingPaymentAndRolloverFee(positionSize, positionMargin, positionLastUpdatedCPF, positionTimestamp, unrealizedPnl) | |
672 | + | let remainMargin = $t02909429306._1 | |
673 | + | let badDebt = $t02909429306._2 | |
684 | 674 | calcMarginRatio(remainMargin, badDebt, positionNotional) | |
685 | 675 | } | |
686 | 676 | ||
701 | 691 | ||
702 | 692 | ||
703 | 693 | func internalClosePosition (_trader,_size,_fee,_minQuoteAssetAmount,_addToMargin,_checkMaxPriceImpact,_liquidate) = { | |
704 | - | let $ | |
705 | - | let oldPositionSize = $ | |
706 | - | let oldPositionMargin = $ | |
707 | - | let oldPositionOpenNotional = $ | |
708 | - | let oldPositionLstUpdCPF = $ | |
709 | - | let oldPositionTimestamp = $ | |
694 | + | let $t03037330529 = getPosition(_trader) | |
695 | + | let oldPositionSize = $t03037330529._1 | |
696 | + | let oldPositionMargin = $t03037330529._2 | |
697 | + | let oldPositionOpenNotional = $t03037330529._3 | |
698 | + | let oldPositionLstUpdCPF = $t03037330529._4 | |
699 | + | let oldPositionTimestamp = $t03037330529._5 | |
710 | 700 | let isLongPosition = (oldPositionSize > 0) | |
711 | 701 | let absOldPositionSize = abs(oldPositionSize) | |
712 | 702 | if (if ((absOldPositionSize >= _size)) | |
714 | 704 | else false) | |
715 | 705 | then { | |
716 | 706 | let isPartialClose = (absOldPositionSize > _size) | |
717 | - | let $ | |
718 | - | let exchangedQuoteAssetAmount = $ | |
719 | - | let quoteAssetReserveAfter = $ | |
720 | - | let baseAssetReserveAfter = $ | |
721 | - | let totalPositionSizeAfter = $ | |
707 | + | let $t03082131272 = swapOutput((oldPositionSize > 0), _size, _checkMaxPriceImpact) | |
708 | + | let exchangedQuoteAssetAmount = $t03082131272._1 | |
709 | + | let quoteAssetReserveAfter = $t03082131272._2 | |
710 | + | let baseAssetReserveAfter = $t03082131272._3 | |
711 | + | let totalPositionSizeAfter = $t03082131272._4 | |
722 | 712 | let exchangedPositionSize = if ((oldPositionSize > 0)) | |
723 | 713 | then -(_size) | |
724 | 714 | else _size | |
725 | - | let $ | |
726 | - | let oldPositionNotional = $ | |
727 | - | let unrealizedPnl = $ | |
715 | + | let $t03148731694 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT) | |
716 | + | let oldPositionNotional = $t03148731694._1 | |
717 | + | let unrealizedPnl = $t03148731694._2 | |
728 | 718 | let realizedRatio = divd(abs(exchangedPositionSize), absOldPositionSize) | |
729 | 719 | let realizedPnl = muld(unrealizedPnl, realizedRatio) | |
730 | - | let $ | |
731 | - | let remainMarginBefore = $ | |
732 | - | let x1 = $ | |
733 | - | let x2 = $ | |
734 | - | let rolloverFee = $ | |
720 | + | let $t03203532281 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, unrealizedPnl) | |
721 | + | let remainMarginBefore = $t03203532281._1 | |
722 | + | let x1 = $t03203532281._2 | |
723 | + | let x2 = $t03203532281._3 | |
724 | + | let rolloverFee = $t03203532281._4 | |
735 | 725 | let positionBadDebt = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, realizedPnl)._2 | |
736 | 726 | let realizedCloseFee = muld(muld(oldPositionNotional, realizedRatio), _fee) | |
737 | 727 | let unrealizedPnlAfter = (unrealizedPnl - realizedPnl) | |
739 | 729 | then ((oldPositionNotional - exchangedQuoteAssetAmount) - unrealizedPnlAfter) | |
740 | 730 | else ((unrealizedPnlAfter + oldPositionNotional) - exchangedQuoteAssetAmount) | |
741 | 731 | let newPositionSize = (oldPositionSize + exchangedPositionSize) | |
742 | - | let $ | |
732 | + | let $t03368734073 = if ((newPositionSize == 0)) | |
743 | 733 | then $Tuple2(0, 0) | |
744 | 734 | else $Tuple2(abs(remainOpenNotional), latestCumulativePremiumFraction(newPositionSize)) | |
745 | - | let newPositionOpenNotional = $ | |
746 | - | let newPositionLstUpdCPF = $ | |
735 | + | let newPositionOpenNotional = $t03368734073._1 | |
736 | + | let newPositionLstUpdCPF = $t03368734073._2 | |
747 | 737 | let openNotionalDelta = (oldPositionOpenNotional - newPositionOpenNotional) | |
748 | 738 | let marginRatio = getMarginRatioByOption(_trader, PNL_OPTION_SPOT) | |
749 | 739 | let newPositionMarginWithSameRatio = if ((oldPositionSize > 0)) | |
780 | 770 | } | |
781 | 771 | ||
782 | 772 | ||
783 | - | func getTwapSpotPrice () = { | |
784 | - | let minuteId = ((lastTimestamp() / 1000) / 60) | |
785 | - | let startMinuteId = (minuteId - TWAP_INTERVAL) | |
786 | - | let listStr = valueOrElse(getString(this, k_lastDataStr), "") | |
787 | - | let list = split(listStr, ",") | |
788 | - | func filterFn (accumulator,next) = if ((startMinuteId >= valueOrErrorMessage(parseInt(next), ("getTwapSpotPrice: invalid int: " + listStr)))) | |
789 | - | then (accumulator :+ parseIntValue(next)) | |
790 | - | else accumulator | |
791 | - | ||
792 | - | let listF = { | |
793 | - | let $l = list | |
794 | - | let $s = size($l) | |
795 | - | let $acc0 = nil | |
796 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
797 | - | then $a | |
798 | - | else filterFn($a, $l[$i]) | |
799 | - | ||
800 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
801 | - | then $a | |
802 | - | else throw("List size exceeds 20") | |
803 | - | ||
804 | - | $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) | |
805 | - | } | |
806 | - | let maxIndex = if ((size(listF) > 0)) | |
807 | - | then max(listF) | |
808 | - | else valueOrErrorMessage(parseInt(list[0]), ("getTwapSpotPrice: invalid int: " + listStr)) | |
809 | - | let lastMinuteId = valueOrElse(getInteger(this, k_lastMinuteId), 0) | |
810 | - | let endLastCumulativePrice = valueOrElse(getInteger(this, ((k_twapDataLastCumulativePrice + "_") + toString(lastMinuteId))), 0) | |
811 | - | let endLastPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(lastMinuteId))), 0) | |
812 | - | let nowCumulativePrice = (endLastCumulativePrice + ((minuteId - lastMinuteId) * endLastPrice)) | |
813 | - | let startLastCumulativePrice = valueOrElse(getInteger(this, ((k_twapDataLastCumulativePrice + "_") + toString(maxIndex))), 0) | |
814 | - | let startLastPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(maxIndex))), 0) | |
815 | - | let startCumulativePrice = (startLastCumulativePrice + ((startMinuteId - maxIndex) * startLastPrice)) | |
816 | - | ((nowCumulativePrice - startCumulativePrice) / TWAP_INTERVAL) | |
817 | - | } | |
818 | - | ||
819 | - | ||
820 | 773 | func getTerminalAmmState () = { | |
821 | 774 | let _positionSize = totalPositionSize() | |
822 | 775 | if ((_positionSize == 0)) | |
823 | 776 | then $Tuple2(qtAstR(), bsAstR()) | |
824 | 777 | else { | |
825 | 778 | let direction = (_positionSize > 0) | |
826 | - | let $ | |
827 | - | let currentNetMarketValue = $ | |
828 | - | let terminalQuoteAssetReserve = $ | |
829 | - | let terminalBaseAssetReserve = $ | |
779 | + | let $t03730837487 = swapOutput(direction, abs(_positionSize), false) | |
780 | + | let currentNetMarketValue = $t03730837487._1 | |
781 | + | let terminalQuoteAssetReserve = $t03730837487._2 | |
782 | + | let terminalBaseAssetReserve = $t03730837487._3 | |
830 | 783 | $Tuple2(terminalQuoteAssetReserve, terminalBaseAssetReserve) | |
831 | 784 | } | |
832 | 785 | } | |
866 | 819 | ||
867 | 820 | func getFunding () = { | |
868 | 821 | let underlyingPrice = getOraclePrice() | |
869 | - | let spotTwapPrice = | |
822 | + | let spotTwapPrice = getSpotPrice() | |
870 | 823 | let premium = (spotTwapPrice - underlyingPrice) | |
871 | 824 | if (if (if ((totalShortPositionSize() == 0)) | |
872 | 825 | then true | |
909 | 862 | func getAdjustedFee (_artifactId,_baseFeeDiscount) = { | |
910 | 863 | let baseFeeRaw = fee() | |
911 | 864 | let baseFee = muld(baseFeeRaw, _baseFeeDiscount) | |
912 | - | let $ | |
865 | + | let $t04122941724 = if ((_artifactId != "")) | |
913 | 866 | then { | |
914 | 867 | let artifactKind = strA(nftManagerAddress(), toCompositeKey(k_token_type, _artifactId)) | |
915 | 868 | if ((artifactKind == FEE_REDUCTION_TOKEN_TYPE)) | |
921 | 874 | else throw("Invalid attached artifact") | |
922 | 875 | } | |
923 | 876 | else $Tuple2(baseFee, false) | |
924 | - | let adjustedFee = $ | |
925 | - | let burnArtifact = $ | |
877 | + | let adjustedFee = $t04122941724._1 | |
878 | + | let burnArtifact = $t04122941724._2 | |
926 | 879 | $Tuple2(adjustedFee, burnArtifact) | |
927 | 880 | } | |
928 | 881 | ||
948 | 901 | case _ => | |
949 | 902 | throw("Invalid computeFeeDiscount result") | |
950 | 903 | } | |
951 | - | let $ | |
952 | - | let adjustedFee = $ | |
953 | - | let burnArtifact = $ | |
904 | + | let $t04240442478 = getAdjustedFee(_artifactId, feeDiscount) | |
905 | + | let adjustedFee = $t04240442478._1 | |
906 | + | let burnArtifact = $t04240442478._2 | |
954 | 907 | $Tuple2(adjustedFee, burnArtifact) | |
955 | 908 | } | |
956 | 909 | else throw("Strict value is not equal to itself.") | |
994 | 947 | func updatePosition (_address,_size,_margin,_openNotional,_latestCumulativePremiumFraction,_latestTimestamp) = [IntegerEntry(toCompositeKey(k_positionSize, _address), _size), IntegerEntry(toCompositeKey(k_positionMargin, _address), _margin), IntegerEntry(toCompositeKey(k_positionOpenNotional, _address), _openNotional), IntegerEntry(toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _address), _latestCumulativePremiumFraction), IntegerEntry(toCompositeKey(k_positionLastUpdatedTimestamp, _address), _latestTimestamp)] | |
995 | 948 | ||
996 | 949 | ||
997 | - | func appendTwap (_price) = { | |
998 | - | let minuteId = ((lastTimestamp() / 1000) / 60) | |
999 | - | let previousMinuteId = valueOrElse(getInteger(this, k_lastMinuteId), 0) | |
1000 | - | if ((previousMinuteId > minuteId)) | |
1001 | - | then throw("TWAP out-of-order") | |
1002 | - | else { | |
1003 | - | let lastMinuteId = if ((previousMinuteId == 0)) | |
1004 | - | then minuteId | |
1005 | - | else previousMinuteId | |
1006 | - | if ((minuteId > previousMinuteId)) | |
1007 | - | then { | |
1008 | - | let prevCumulativePrice = valueOrElse(getInteger(this, ((k_twapDataLastCumulativePrice + "_") + toString(previousMinuteId))), 0) | |
1009 | - | let prevPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(previousMinuteId))), _price) | |
1010 | - | let lastCumulativePrice = (prevCumulativePrice + ((minuteId - lastMinuteId) * prevPrice)) | |
1011 | - | let list = pushToQueue(strToList(valueOrElse(getString(this, k_lastDataStr), "")), TWAP_INTERVAL, toString(minuteId)) | |
1012 | - | [IntegerEntry(toCompositeKey(k_twapDataLastCumulativePrice, toString(minuteId)), lastCumulativePrice), IntegerEntry(toCompositeKey(k_twapDataLastPrice, toString(minuteId)), _price), IntegerEntry(toCompositeKey(k_twapDataPreviousMinuteId, toString(minuteId)), previousMinuteId), IntegerEntry(k_lastMinuteId, minuteId), StringEntry(k_lastDataStr, listToStr(list))] | |
1013 | - | } | |
1014 | - | else { | |
1015 | - | let twapDataPreviousMinuteId = valueOrElse(getInteger(this, toCompositeKey(k_twapDataPreviousMinuteId, toString(minuteId))), 0) | |
1016 | - | let prevCumulativePrice = valueOrElse(getInteger(this, toCompositeKey(k_twapDataLastCumulativePrice, toString(twapDataPreviousMinuteId))), 0) | |
1017 | - | let prevPrice = valueOrElse(getInteger(this, toCompositeKey(k_twapDataLastPrice, toString(twapDataPreviousMinuteId))), _price) | |
1018 | - | let lastCumulativePrice = (prevCumulativePrice + ((minuteId - twapDataPreviousMinuteId) * prevPrice)) | |
1019 | - | [IntegerEntry(toCompositeKey(k_twapDataLastCumulativePrice, toString(minuteId)), lastCumulativePrice), IntegerEntry(toCompositeKey(k_twapDataLastPrice, toString(minuteId)), _price)] | |
1020 | - | } | |
1021 | - | } | |
1022 | - | } | |
1023 | - | ||
1024 | - | ||
1025 | 950 | func updateAmmReserves (_qtAstR,_bsAstR) = [IntegerEntry(k_quoteAssetReserve, _qtAstR), IntegerEntry(k_baseAssetReserve, _bsAstR)] | |
1026 | 951 | ||
1027 | 952 | ||
1033 | 958 | let _bsAstW = bsAstW() | |
1034 | 959 | if (((_totalLongPositionSize - _totalShortPositionSize) != _totalPositionSizeAfter)) | |
1035 | 960 | then throw(((((("Invalid AMM state data: " + toString(_totalLongPositionSize)) + " + ") + toString(_totalShortPositionSize)) + " != ") + toString(_totalPositionSizeAfter))) | |
1036 | - | else | |
961 | + | else (updateAmmReserves(_qtAstR, _bsAstR) ++ [IntegerEntry(k_totalPositionSize, _totalPositionSizeAfter), IntegerEntry(k_openInterestNotional, _openInterestNotional), IntegerEntry(k_totalLongPositionSize, _totalLongPositionSize), IntegerEntry(k_totalShortPositionSize, _totalShortPositionSize), IntegerEntry(k_openInterestLong, _totalLongOpenNotional), IntegerEntry(k_openInterestShort, _totalShortOpenNotional)]) | |
1037 | 962 | } | |
1038 | 963 | ||
1039 | 964 | ||
1103 | 1028 | let qtAstRAfter = (_qtAstR + _quoteAssetAmount) | |
1104 | 1029 | let baseAssetAmountToAdd = (divd(muld(qtAstRAfter, _qtAstW), price) - _bsAstR) | |
1105 | 1030 | let bsAstRAfter = (_bsAstR + baseAssetAmountToAdd) | |
1106 | - | let $ | |
1107 | - | let newQuoteAssetWeight = $ | |
1108 | - | let newBaseAssetWeight = $ | |
1109 | - | let marginToVault = $ | |
1031 | + | let $t05043150582 = getSyncTerminalPrice(getOraclePrice(), qtAstRAfter, bsAstRAfter) | |
1032 | + | let newQuoteAssetWeight = $t05043150582._1 | |
1033 | + | let newBaseAssetWeight = $t05043150582._2 | |
1034 | + | let marginToVault = $t05043150582._3 | |
1110 | 1035 | let doExchangePnL = if ((marginToVault != 0)) | |
1111 | 1036 | then { | |
1112 | 1037 | let doExchangePnL = invoke(vaultAddress(), "exchangeFreeAndLocked", [marginToVault], nil) | |
1136 | 1061 | let qtAstRAfter = (_qtAstR - _quoteAssetAmount) | |
1137 | 1062 | let baseAssetAmountToRemove = abs((divd(muld(qtAstRAfter, _qtAstW), price) - _bsAstR)) | |
1138 | 1063 | let bsAstRAfter = (_bsAstR - baseAssetAmountToRemove) | |
1139 | - | let $ | |
1140 | - | let newQuoteAssetWeight = $ | |
1141 | - | let newBaseAssetWeight = $ | |
1142 | - | let marginToVault = $ | |
1064 | + | let $t05167851829 = getSyncTerminalPrice(getOraclePrice(), qtAstRAfter, bsAstRAfter) | |
1065 | + | let newQuoteAssetWeight = $t05167851829._1 | |
1066 | + | let newBaseAssetWeight = $t05167851829._2 | |
1067 | + | let marginToVault = $t05167851829._3 | |
1143 | 1068 | let doExchangePnL = if ((marginToVault != 0)) | |
1144 | 1069 | then { | |
1145 | 1070 | let doExchangePnL = invoke(vaultAddress(), "exchangeFreeAndLocked", [marginToVault], nil) | |
1275 | 1200 | else isMarketClosed()) | |
1276 | 1201 | then throw("Invalid increasePosition parameters") | |
1277 | 1202 | else { | |
1278 | - | let $ | |
1279 | - | let adjustedFee = $ | |
1280 | - | let burnArtifact = $ | |
1203 | + | let $t05795358102 = getForTraderWithArtifact(_trader, getArtifactId(i)) | |
1204 | + | let adjustedFee = $t05795358102._1 | |
1205 | + | let burnArtifact = $t05795358102._2 | |
1281 | 1206 | let _amount = divd(_rawAmount, (muld(adjustedFee, _leverage) + DECIMAL_UNIT)) | |
1282 | 1207 | let distributeFeeAmount = (_rawAmount - _amount) | |
1283 | 1208 | let referrerFeeAny = invoke(referralAddress(), "acceptPaymentWithLink", [_trader, _refLink], [AttachedPayment(quoteAsset(), distributeFeeAmount)]) | |
1290 | 1215 | throw("Invalid referrerFee") | |
1291 | 1216 | } | |
1292 | 1217 | let feeAmount = (distributeFeeAmount - referrerFee) | |
1293 | - | let $ | |
1294 | - | let oldPositionSize = $ | |
1295 | - | let oldPositionMargin = $ | |
1296 | - | let oldPositionOpenNotional = $ | |
1297 | - | let oldPositionLstUpdCPF = $ | |
1298 | - | let oldPositionTimestamp = $ | |
1218 | + | let $t05859858766 = getPosition(_trader) | |
1219 | + | let oldPositionSize = $t05859858766._1 | |
1220 | + | let oldPositionMargin = $t05859858766._2 | |
1221 | + | let oldPositionOpenNotional = $t05859858766._3 | |
1222 | + | let oldPositionLstUpdCPF = $t05859858766._4 | |
1223 | + | let oldPositionTimestamp = $t05859858766._5 | |
1299 | 1224 | let isNewPosition = (oldPositionSize == 0) | |
1300 | 1225 | let isSameDirection = if ((oldPositionSize > 0)) | |
1301 | 1226 | then (_direction == DIR_LONG) | |
1304 | 1229 | then isSameDirection | |
1305 | 1230 | else false | |
1306 | 1231 | let isAdd = (_direction == DIR_LONG) | |
1307 | - | let $ | |
1232 | + | let $t05905562176 = if (if (isNewPosition) | |
1308 | 1233 | then true | |
1309 | 1234 | else expandExisting) | |
1310 | 1235 | then { | |
1311 | 1236 | let openNotional = muld(_amount, _leverage) | |
1312 | - | let $ | |
1313 | - | let amountBaseAssetBought = $ | |
1314 | - | let quoteAssetReserveAfter = $ | |
1315 | - | let baseAssetReserveAfter = $ | |
1316 | - | let totalPositionSizeAfter = $ | |
1237 | + | let $t05956459737 = swapInput(isAdd, openNotional) | |
1238 | + | let amountBaseAssetBought = $t05956459737._1 | |
1239 | + | let quoteAssetReserveAfter = $t05956459737._2 | |
1240 | + | let baseAssetReserveAfter = $t05956459737._3 | |
1241 | + | let totalPositionSizeAfter = $t05956459737._4 | |
1317 | 1242 | if (if ((_minBaseAssetAmount != 0)) | |
1318 | 1243 | then (_minBaseAssetAmount > abs(amountBaseAssetBought)) | |
1319 | 1244 | else false) | |
1326 | 1251 | let totalShortOpenInterestAfter = (openInterestShort() + (if ((0 > newPositionSize)) | |
1327 | 1252 | then openNotional | |
1328 | 1253 | else 0)) | |
1329 | - | let $ | |
1330 | - | let remainMargin = $ | |
1331 | - | let x1 = $ | |
1332 | - | let x2 = $ | |
1333 | - | let rolloverFee = $ | |
1254 | + | let $t06028360558 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, _amount) | |
1255 | + | let remainMargin = $t06028360558._1 | |
1256 | + | let x1 = $t06028360558._2 | |
1257 | + | let x2 = $t06028360558._3 | |
1258 | + | let rolloverFee = $t06028360558._4 | |
1334 | 1259 | if (!(requireNotOverSpreadLimit(quoteAssetReserveAfter, baseAssetReserveAfter))) | |
1335 | 1260 | then throw("Over max spread limit") | |
1336 | 1261 | else if (!(requireNotOverMaxOpenNotional(totalLongOpenInterestAfter, totalShortOpenInterestAfter))) | |
1344 | 1269 | } | |
1345 | 1270 | else { | |
1346 | 1271 | let openNotional = muld(_amount, _leverage) | |
1347 | - | let $ | |
1348 | - | let oldPositionNotional = $ | |
1349 | - | let unrealizedPnl = $ | |
1272 | + | let $t06187661992 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT) | |
1273 | + | let oldPositionNotional = $t06187661992._1 | |
1274 | + | let unrealizedPnl = $t06187661992._2 | |
1350 | 1275 | if ((oldPositionNotional > openNotional)) | |
1351 | 1276 | then throw("Use decreasePosition to decrease position size") | |
1352 | 1277 | else throw("Close position first") | |
1353 | 1278 | } | |
1354 | - | let newPositionSize = $ | |
1355 | - | let newPositionRemainMargin = $ | |
1356 | - | let newPositionOpenNotional = $ | |
1357 | - | let newPositionLatestCPF = $ | |
1358 | - | let newPositionTimestamp = $ | |
1359 | - | let baseAssetReserveAfter = $ | |
1360 | - | let quoteAssetReserveAfter = $ | |
1361 | - | let totalPositionSizeAfter = $ | |
1362 | - | let openInterestNotionalAfter = $ | |
1363 | - | let totalLongAfter = $ | |
1364 | - | let totalShortAfter = $ | |
1365 | - | let totalLongOpenInterestAfter = $ | |
1366 | - | let totalShortOpenInterestAfter = $ | |
1367 | - | let rolloverFee = $ | |
1368 | - | let $ | |
1369 | - | let feeToStakers = $ | |
1370 | - | let feeToVault = $ | |
1279 | + | let newPositionSize = $t05905562176._1 | |
1280 | + | let newPositionRemainMargin = $t05905562176._2 | |
1281 | + | let newPositionOpenNotional = $t05905562176._3 | |
1282 | + | let newPositionLatestCPF = $t05905562176._4 | |
1283 | + | let newPositionTimestamp = $t05905562176._5 | |
1284 | + | let baseAssetReserveAfter = $t05905562176._6 | |
1285 | + | let quoteAssetReserveAfter = $t05905562176._7 | |
1286 | + | let totalPositionSizeAfter = $t05905562176._8 | |
1287 | + | let openInterestNotionalAfter = $t05905562176._9 | |
1288 | + | let totalLongAfter = $t05905562176._10 | |
1289 | + | let totalShortAfter = $t05905562176._11 | |
1290 | + | let totalLongOpenInterestAfter = $t05905562176._12 | |
1291 | + | let totalShortOpenInterestAfter = $t05905562176._13 | |
1292 | + | let rolloverFee = $t05905562176._14 | |
1293 | + | let $t06218262253 = distributeFee((feeAmount + rolloverFee)) | |
1294 | + | let feeToStakers = $t06218262253._1 | |
1295 | + | let feeToVault = $t06218262253._2 | |
1371 | 1296 | let stake = if ((_amount >= rolloverFee)) | |
1372 | 1297 | then invoke(vaultAddress(), "addLocked", nil, [AttachedPayment(quoteAsset(), (_amount - rolloverFee))]) | |
1373 | 1298 | else invoke(vaultAddress(), "withdrawLocked", [(rolloverFee - _amount)], nil) | |
1428 | 1353 | else isMarketClosed()) | |
1429 | 1354 | then throw("Invalid addMargin parameters") | |
1430 | 1355 | else { | |
1431 | - | let $ | |
1432 | - | let oldPositionSize = $ | |
1433 | - | let oldPositionMargin = $ | |
1434 | - | let oldPositionOpenNotional = $ | |
1435 | - | let oldPositionLstUpdCPF = $ | |
1436 | - | let oldPositionTimestamp = $ | |
1356 | + | let $t06451064678 = getPosition(_trader) | |
1357 | + | let oldPositionSize = $t06451064678._1 | |
1358 | + | let oldPositionMargin = $t06451064678._2 | |
1359 | + | let oldPositionOpenNotional = $t06451064678._3 | |
1360 | + | let oldPositionLstUpdCPF = $t06451064678._4 | |
1361 | + | let oldPositionTimestamp = $t06451064678._5 | |
1437 | 1362 | let stake = invoke(vaultAddress(), "addLocked", nil, [AttachedPayment(quoteAsset(), _amount)]) | |
1438 | 1363 | if ((stake == stake)) | |
1439 | 1364 | then { | |
1440 | 1365 | let rolloverFee = calcRolloverFee(oldPositionMargin, oldPositionTimestamp) | |
1441 | 1366 | let doTransferFeeToStakers = if ((rolloverFee > 0)) | |
1442 | 1367 | then { | |
1443 | - | let $ | |
1444 | - | let feeToStakers = $ | |
1445 | - | let feeToVault = $ | |
1368 | + | let $t06496365022 = distributeFee(rolloverFee) | |
1369 | + | let feeToStakers = $t06496365022._1 | |
1370 | + | let feeToVault = $t06496365022._2 | |
1446 | 1371 | let unstake = invoke(vaultAddress(), "withdrawLocked", [feeToStakers], nil) | |
1447 | 1372 | if ((unstake == unstake)) | |
1448 | 1373 | then { | |
1488 | 1413 | else isMarketClosed()) | |
1489 | 1414 | then throw("Invalid removeMargin parameters") | |
1490 | 1415 | else { | |
1491 | - | let $ | |
1492 | - | let oldPositionSize = $ | |
1493 | - | let oldPositionMargin = $ | |
1494 | - | let oldPositionOpenNotional = $ | |
1495 | - | let oldPositionLstUpdCPF = $ | |
1496 | - | let oldPositionTimestamp = $ | |
1497 | - | let $ | |
1498 | - | let remainMargin = $ | |
1499 | - | let badDebt = $ | |
1500 | - | let fundingPayment = $ | |
1501 | - | let rolloverFee = $ | |
1416 | + | let $t06639566563 = getPosition(_trader) | |
1417 | + | let oldPositionSize = $t06639566563._1 | |
1418 | + | let oldPositionMargin = $t06639566563._2 | |
1419 | + | let oldPositionOpenNotional = $t06639566563._3 | |
1420 | + | let oldPositionLstUpdCPF = $t06639566563._4 | |
1421 | + | let oldPositionTimestamp = $t06639566563._5 | |
1422 | + | let $t06656966818 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, -(_amount)) | |
1423 | + | let remainMargin = $t06656966818._1 | |
1424 | + | let badDebt = $t06656966818._2 | |
1425 | + | let fundingPayment = $t06656966818._3 | |
1426 | + | let rolloverFee = $t06656966818._4 | |
1502 | 1427 | if ((badDebt != 0)) | |
1503 | 1428 | then throw("Invalid removed margin amount") | |
1504 | 1429 | else { | |
1506 | 1431 | if (!(requireMoreMarginRatio(marginRatio, initMarginRatio(), true))) | |
1507 | 1432 | then throw(((("Too much margin removed: " + toString(marginRatio)) + " < ") + toString(initMarginRatio()))) | |
1508 | 1433 | else { | |
1509 | - | let $ | |
1510 | - | let feeToStakers = $ | |
1511 | - | let feeToVault = $ | |
1434 | + | let $t06720467263 = distributeFee(rolloverFee) | |
1435 | + | let feeToStakers = $t06720467263._1 | |
1436 | + | let feeToVault = $t06720467263._2 | |
1512 | 1437 | let doTransferFeeToStakers = if ((rolloverFee > 0)) | |
1513 | 1438 | then { | |
1514 | 1439 | let lockBadDebt = invoke(vaultAddress(), "exchangeFreeAndLocked", [-(feeToVault)], nil) | |
1561 | 1486 | then throw("Invalid closePosition parameters") | |
1562 | 1487 | else { | |
1563 | 1488 | let oldPositionTimestamp = getPosition(_trader)._5 | |
1564 | - | let $ | |
1565 | - | let newPositionSize = $ | |
1566 | - | let newPositionMargin = $ | |
1567 | - | let newPositionOpenNotional = $ | |
1568 | - | let newPositionLstUpdCPF = $ | |
1569 | - | let positionBadDebt = $ | |
1570 | - | let realizedPnl = $ | |
1571 | - | let marginToTrader = $ | |
1572 | - | let quoteAssetReserveAfter = $ | |
1573 | - | let baseAssetReserveAfter = $ | |
1574 | - | let totalPositionSizeAfter = $ | |
1575 | - | let openInterestNotionalAfter = $ | |
1576 | - | let totalLongAfter = $ | |
1577 | - | let totalShortAfter = $ | |
1578 | - | let totalLongOpenInterestAfter = $ | |
1579 | - | let totalShortOpenInterestAfter = $ | |
1580 | - | let realizedFee = $ | |
1489 | + | let $t06943870023 = internalClosePosition(_trader, _size, positionFee, _minQuoteAssetAmount, _addToMargin, true, true) | |
1490 | + | let newPositionSize = $t06943870023._1 | |
1491 | + | let newPositionMargin = $t06943870023._2 | |
1492 | + | let newPositionOpenNotional = $t06943870023._3 | |
1493 | + | let newPositionLstUpdCPF = $t06943870023._4 | |
1494 | + | let positionBadDebt = $t06943870023._5 | |
1495 | + | let realizedPnl = $t06943870023._6 | |
1496 | + | let marginToTrader = $t06943870023._7 | |
1497 | + | let quoteAssetReserveAfter = $t06943870023._8 | |
1498 | + | let baseAssetReserveAfter = $t06943870023._9 | |
1499 | + | let totalPositionSizeAfter = $t06943870023._10 | |
1500 | + | let openInterestNotionalAfter = $t06943870023._11 | |
1501 | + | let totalLongAfter = $t06943870023._12 | |
1502 | + | let totalShortAfter = $t06943870023._13 | |
1503 | + | let totalLongOpenInterestAfter = $t06943870023._14 | |
1504 | + | let totalShortOpenInterestAfter = $t06943870023._15 | |
1505 | + | let realizedFee = $t06943870023._16 | |
1581 | 1506 | if ((positionBadDebt > 0)) | |
1582 | 1507 | then throw("Invalid closePosition parameters: bad debt") | |
1583 | 1508 | else if ((oldPositionTimestamp >= lastTimestamp())) | |
1592 | 1517 | let unstake = invoke(vaultAddress(), "withdrawLocked", [withdrawAmount], nil) | |
1593 | 1518 | if ((unstake == unstake)) | |
1594 | 1519 | then { | |
1595 | - | let $ | |
1596 | - | let feeToStakers = $ | |
1597 | - | let feeToVault = $ | |
1520 | + | let $t07069570754 = distributeFee(realizedFee) | |
1521 | + | let feeToStakers = $t07069570754._1 | |
1522 | + | let feeToVault = $t07069570754._2 | |
1598 | 1523 | let depositVault = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)]) | |
1599 | 1524 | if ((depositVault == depositVault)) | |
1600 | 1525 | then { | |
1655 | 1580 | else false | |
1656 | 1581 | let oldPositionSize = getPosition(_trader)._1 | |
1657 | 1582 | let positionSizeAbs = abs(oldPositionSize) | |
1658 | - | let $ | |
1583 | + | let $t07317573498 = if (isPartialLiquidation) | |
1659 | 1584 | then { | |
1660 | 1585 | let liquidationSize = getPartialLiquidationAmount(_trader, oldPositionSize) | |
1661 | 1586 | let liquidationRatio = divd(abs(liquidationSize), positionSizeAbs) | |
1662 | 1587 | $Tuple2(liquidationRatio, abs(liquidationSize)) | |
1663 | 1588 | } | |
1664 | 1589 | else $Tuple2(0, positionSizeAbs) | |
1665 | - | let liquidationRatio = $ | |
1666 | - | let liquidationSize = $ | |
1667 | - | let $ | |
1590 | + | let liquidationRatio = $t07317573498._1 | |
1591 | + | let liquidationSize = $t07317573498._2 | |
1592 | + | let $t07350474142 = internalClosePosition(_trader, if (isPartialLiquidation) | |
1668 | 1593 | then liquidationSize | |
1669 | 1594 | else positionSizeAbs, liquidationFeeRatio(), 0, true, false, true) | |
1670 | - | let newPositionSize = $ | |
1671 | - | let newPositionMargin = $ | |
1672 | - | let newPositionOpenNotional = $ | |
1673 | - | let newPositionLstUpdCPF = $ | |
1674 | - | let positionBadDebt = $ | |
1675 | - | let realizedPnl = $ | |
1676 | - | let marginToTrader = $ | |
1677 | - | let quoteAssetReserveAfter = $ | |
1678 | - | let baseAssetReserveAfter = $ | |
1679 | - | let totalPositionSizeAfter = $ | |
1680 | - | let openInterestNotionalAfter = $ | |
1681 | - | let totalLongAfter = $ | |
1682 | - | let totalShortAfter = $ | |
1683 | - | let totalLongOpenInterestAfter = $ | |
1684 | - | let totalShortOpenInterestAfter = $ | |
1685 | - | let liquidationPenalty = $ | |
1595 | + | let newPositionSize = $t07350474142._1 | |
1596 | + | let newPositionMargin = $t07350474142._2 | |
1597 | + | let newPositionOpenNotional = $t07350474142._3 | |
1598 | + | let newPositionLstUpdCPF = $t07350474142._4 | |
1599 | + | let positionBadDebt = $t07350474142._5 | |
1600 | + | let realizedPnl = $t07350474142._6 | |
1601 | + | let marginToTrader = $t07350474142._7 | |
1602 | + | let quoteAssetReserveAfter = $t07350474142._8 | |
1603 | + | let baseAssetReserveAfter = $t07350474142._9 | |
1604 | + | let totalPositionSizeAfter = $t07350474142._10 | |
1605 | + | let openInterestNotionalAfter = $t07350474142._11 | |
1606 | + | let totalLongAfter = $t07350474142._12 | |
1607 | + | let totalShortAfter = $t07350474142._13 | |
1608 | + | let totalLongOpenInterestAfter = $t07350474142._14 | |
1609 | + | let totalShortOpenInterestAfter = $t07350474142._15 | |
1610 | + | let liquidationPenalty = $t07350474142._16 | |
1686 | 1611 | let feeToLiquidator = (liquidationPenalty / 2) | |
1687 | 1612 | let feeToVault = (liquidationPenalty - feeToLiquidator) | |
1688 | 1613 | let ammBalance = (cbalance() - liquidationPenalty) | |
1738 | 1663 | then throw(((("Invalid funding block timestamp: " + toString(lastTimestamp())) + " < ") + toString(fundingBlockTimestamp))) | |
1739 | 1664 | else { | |
1740 | 1665 | let underlyingPrice = getOraclePrice() | |
1741 | - | let $ | |
1742 | - | let shortPremiumFraction = $ | |
1743 | - | let longPremiumFraction = $ | |
1744 | - | let premiumToVault = $ | |
1666 | + | let $t07625576333 = getFunding() | |
1667 | + | let shortPremiumFraction = $t07625576333._1 | |
1668 | + | let longPremiumFraction = $t07625576333._2 | |
1669 | + | let premiumToVault = $t07625576333._3 | |
1745 | 1670 | let doPayFundingToVault = if ((premiumToVault > 0)) | |
1746 | 1671 | then { | |
1747 | 1672 | let doPayFundingToVault = invoke(vaultAddress(), "exchangeFreeAndLocked", [-(premiumToVault)], nil) | |
1764 | 1689 | func syncTerminalPriceToOracle () = { | |
1765 | 1690 | let _qtAstR = qtAstR() | |
1766 | 1691 | let _bsAstR = bsAstR() | |
1767 | - | let $ | |
1768 | - | let newQuoteAssetWeight = $ | |
1769 | - | let newBaseAssetWeight = $ | |
1770 | - | let marginToVault = $ | |
1692 | + | let $t07738477750 = getSyncTerminalPrice(getOraclePrice(), _qtAstR, _bsAstR) | |
1693 | + | let newQuoteAssetWeight = $t07738477750._1 | |
1694 | + | let newBaseAssetWeight = $t07738477750._2 | |
1695 | + | let marginToVault = $t07738477750._3 | |
1771 | 1696 | let marginToVaultAdj = if (if ((0 > marginToVault)) | |
1772 | 1697 | then (abs(marginToVault) > cbalance()) | |
1773 | 1698 | else false) | |
1782 | 1707 | } | |
1783 | 1708 | else nil | |
1784 | 1709 | if ((doExchangePnL == doExchangePnL)) | |
1785 | - | then | |
1710 | + | then (updateBalance((cbalance() + marginToVaultAdj)) ++ updateAmmWeights(newQuoteAssetWeight, newBaseAssetWeight)) | |
1786 | 1711 | else throw("Strict value is not equal to itself.") | |
1787 | 1712 | } | |
1788 | 1713 | ||
1805 | 1730 | let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1806 | 1731 | if ((sync == sync)) | |
1807 | 1732 | then { | |
1808 | - | let $ | |
1809 | - | let positionSize = $ | |
1810 | - | let positionMargin = $ | |
1811 | - | let pon = $ | |
1812 | - | let positionLstUpdCPF = $ | |
1813 | - | let positionTimestamp = $ | |
1814 | - | let $ | |
1815 | - | let positionNotional = $ | |
1816 | - | let unrealizedPnl = $ | |
1817 | - | let $ | |
1818 | - | let remainMargin = $ | |
1819 | - | let badDebt = $ | |
1820 | - | let fundingPayment = $ | |
1821 | - | let rolloverFee = $ | |
1733 | + | let $t07929979423 = getPosition(_trader) | |
1734 | + | let positionSize = $t07929979423._1 | |
1735 | + | let positionMargin = $t07929979423._2 | |
1736 | + | let pon = $t07929979423._3 | |
1737 | + | let positionLstUpdCPF = $t07929979423._4 | |
1738 | + | let positionTimestamp = $t07929979423._5 | |
1739 | + | let $t07942679527 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT) | |
1740 | + | let positionNotional = $t07942679527._1 | |
1741 | + | let unrealizedPnl = $t07942679527._2 | |
1742 | + | let $t07953079754 = calcRemainMarginWithFundingPaymentAndRolloverFee(positionSize, positionMargin, positionLstUpdCPF, positionTimestamp, unrealizedPnl) | |
1743 | + | let remainMargin = $t07953079754._1 | |
1744 | + | let badDebt = $t07953079754._2 | |
1745 | + | let fundingPayment = $t07953079754._3 | |
1746 | + | let rolloverFee = $t07953079754._4 | |
1822 | 1747 | throw(((((((s(remainMargin) + s(fundingPayment)) + s(getMarginRatio(_trader))) + s(unrealizedPnl)) + s(badDebt)) + s(positionNotional)) + s(rolloverFee))) | |
1823 | 1748 | } | |
1824 | 1749 | else throw("Strict value is not equal to itself.") | |
1838 | 1763 | ||
1839 | 1764 | @Callable(i) | |
1840 | 1765 | func view_getTerminalAmmPrice () = { | |
1841 | - | let $ | |
1842 | - | let terminalQuoteAssetReserve = $ | |
1843 | - | let terminalBaseAssetReserve = $ | |
1766 | + | let $t08047780558 = getTerminalAmmState() | |
1767 | + | let terminalQuoteAssetReserve = $t08047780558._1 | |
1768 | + | let terminalBaseAssetReserve = $t08047780558._2 | |
1844 | 1769 | let price = divd(muld(terminalQuoteAssetReserve, qtAstW()), muld(terminalBaseAssetReserve, bsAstW())) | |
1845 | 1770 | throw(toString(price)) | |
1846 | 1771 | } | |
1850 | 1775 | @Callable(i) | |
1851 | 1776 | func view_getFunding () = { | |
1852 | 1777 | let underlyingPrice = getOraclePrice() | |
1853 | - | let $ | |
1854 | - | let shortPremiumFraction = $ | |
1855 | - | let longPremiumFraction = $ | |
1856 | - | let premiumToVault = $ | |
1778 | + | let $t08106781145 = getFunding() | |
1779 | + | let shortPremiumFraction = $t08106781145._1 | |
1780 | + | let longPremiumFraction = $t08106781145._2 | |
1781 | + | let premiumToVault = $t08106781145._3 | |
1857 | 1782 | let longFunding = divd(longPremiumFraction, underlyingPrice) | |
1858 | 1783 | let shortFunding = divd(shortPremiumFraction, underlyingPrice) | |
1859 | - | throw(((((s(longFunding) + s(shortFunding)) + s( | |
1784 | + | throw(((((s(longFunding) + s(shortFunding)) + s(getSpotPrice())) + s(getOraclePrice())) + s(premiumToVault))) | |
1860 | 1785 | } | |
1861 | 1786 | ||
1862 | 1787 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let k_baseOracle = "k_baseOracle" | |
5 | 5 | ||
6 | 6 | let k_quoteOracle = "k_quoteOracle" | |
7 | 7 | ||
8 | 8 | let k_balance = "k_balance" | |
9 | 9 | ||
10 | 10 | let k_sequence = "k_sequence" | |
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_positionSequence = "k_positionSequence" | |
21 | 21 | ||
22 | 22 | let k_positionAsset = "k_positionAsset" | |
23 | 23 | ||
24 | 24 | let k_positionFee = "k_positionFee" | |
25 | 25 | ||
26 | 26 | let k_positionLastUpdatedTimestamp = "k_positionTimestamp" | |
27 | 27 | ||
28 | 28 | let k_initialized = "k_initialized" | |
29 | 29 | ||
30 | 30 | let k_paused = "k_paused" | |
31 | 31 | ||
32 | 32 | let k_closeOnly = "k_closeOnly" | |
33 | 33 | ||
34 | 34 | let k_fee = "k_fee" | |
35 | 35 | ||
36 | 36 | let k_rolloverFee = "k_rollover_fee" | |
37 | 37 | ||
38 | 38 | let k_fundingPeriod = "k_fundingPeriod" | |
39 | 39 | ||
40 | 40 | let k_initMarginRatio = "k_initMarginRatio" | |
41 | 41 | ||
42 | 42 | let k_maintenanceMarginRatio = "k_mmr" | |
43 | 43 | ||
44 | 44 | let k_liquidationFeeRatio = "k_liquidationFeeRatio" | |
45 | 45 | ||
46 | 46 | let k_partialLiquidationRatio = "k_partLiquidationRatio" | |
47 | 47 | ||
48 | 48 | let k_spreadLimit = "k_spreadLimit" | |
49 | 49 | ||
50 | 50 | let k_maxPriceImpact = "k_maxPriceImpact" | |
51 | 51 | ||
52 | 52 | let k_maxPriceSpread = "k_maxPriceSpread" | |
53 | 53 | ||
54 | 54 | let k_maxOpenNotional = "k_maxOpenNotional" | |
55 | 55 | ||
56 | 56 | let k_feeToStakersPercent = "k_feeToStakersPercent" | |
57 | 57 | ||
58 | 58 | let k_maxOracleDelay = "k_maxOracleDelay" | |
59 | 59 | ||
60 | 60 | let k_fundingMode = "k_fundingMode" | |
61 | - | ||
62 | - | let k_lastDataStr = "k_lastDataStr" | |
63 | - | ||
64 | - | let k_lastMinuteId = "k_lastMinuteId" | |
65 | - | ||
66 | - | let k_twapDataLastCumulativePrice = "k_twapDataLastCumulativePrice" | |
67 | - | ||
68 | - | let k_twapDataLastPrice = "k_twapDataLastPrice" | |
69 | - | ||
70 | - | let k_twapDataPreviousMinuteId = "k_twapDataPreviousMinuteId" | |
71 | 61 | ||
72 | 62 | let k_latestLongCumulativePremiumFraction = "k_latestLongPremiumFraction" | |
73 | 63 | ||
74 | 64 | let k_latestShortCumulativePremiumFraction = "k_latestShortPremiumFraction" | |
75 | 65 | ||
76 | 66 | let k_nextFundingBlock = "k_nextFundingBlockMinTimestamp" | |
77 | 67 | ||
78 | 68 | let k_longFundingRate = "k_longFundingRate" | |
79 | 69 | ||
80 | 70 | let k_shortFundingRate = "k_shortFundingRate" | |
81 | 71 | ||
82 | 72 | let k_quoteAssetReserve = "k_qtAstR" | |
83 | 73 | ||
84 | 74 | let k_baseAssetReserve = "k_bsAstR" | |
85 | 75 | ||
86 | 76 | let k_quoteAssetWeight = "k_qtAstW" | |
87 | 77 | ||
88 | 78 | let k_baseAssetWeight = "k_bsAstW" | |
89 | 79 | ||
90 | 80 | let k_totalPositionSize = "k_totalPositionSize" | |
91 | 81 | ||
92 | 82 | let k_totalLongPositionSize = "k_totalLongPositionSize" | |
93 | 83 | ||
94 | 84 | let k_totalShortPositionSize = "k_totalShortPositionSize" | |
95 | 85 | ||
96 | 86 | let k_openInterestNotional = "k_openInterestNotional" | |
97 | 87 | ||
98 | 88 | let k_openInterestShort = "k_openInterestShort" | |
99 | 89 | ||
100 | 90 | let k_openInterestLong = "k_openInterestLong" | |
101 | 91 | ||
102 | 92 | let k_lastTx = "k_lastTx" | |
103 | 93 | ||
104 | 94 | let k_coordinatorAddress = "k_coordinatorAddress" | |
105 | 95 | ||
106 | 96 | let k_vault_address = "k_vault_address" | |
107 | 97 | ||
108 | 98 | let k_admin_address = "k_admin_address" | |
109 | 99 | ||
110 | 100 | let k_quote_asset = "k_quote_asset" | |
111 | 101 | ||
112 | 102 | let k_quote_staking = "k_quote_staking" | |
113 | 103 | ||
114 | 104 | let k_staking_address = "k_staking_address" | |
115 | 105 | ||
116 | 106 | let k_miner_address = "k_miner_address" | |
117 | 107 | ||
118 | 108 | let k_orders_address = "k_orders_address" | |
119 | 109 | ||
120 | 110 | let k_referral_address = "k_referral_address" | |
121 | 111 | ||
122 | 112 | let k_exchange_address = "k_exchange_address" | |
123 | 113 | ||
124 | 114 | let k_nft_manager_address = "k_nft_manager_address" | |
125 | 115 | ||
126 | 116 | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
127 | 117 | ||
128 | 118 | ||
129 | 119 | func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set") | |
130 | 120 | ||
131 | 121 | ||
132 | 122 | func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address)) | |
133 | 123 | ||
134 | 124 | ||
135 | 125 | func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset)) | |
136 | 126 | ||
137 | 127 | ||
138 | 128 | func quoteAssetStaking () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_quote_staking)), "Quote asset staking not set") | |
139 | 129 | ||
140 | 130 | ||
141 | 131 | func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), "Staking not set") | |
142 | 132 | ||
143 | 133 | ||
144 | 134 | func vaultAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_vault_address)), "Vault not set") | |
145 | 135 | ||
146 | 136 | ||
147 | 137 | func minerAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_miner_address)), "Miner not set") | |
148 | 138 | ||
149 | 139 | ||
150 | 140 | func ordersAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_orders_address)), "Orders not set") | |
151 | 141 | ||
152 | 142 | ||
153 | 143 | func referralAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_referral_address)), "Referral not set") | |
154 | 144 | ||
155 | 145 | ||
156 | 146 | func nftManagerAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_nft_manager_address)), "NFT Manager not set") | |
157 | 147 | ||
158 | 148 | ||
159 | 149 | let k_token_param = "k_token_param" | |
160 | 150 | ||
161 | 151 | let k_token_type = "k_token_type" | |
162 | 152 | ||
163 | 153 | let FEE_REDUCTION_TOKEN_TYPE = "fee_reduction" | |
164 | 154 | ||
165 | 155 | let DIR_LONG = 1 | |
166 | 156 | ||
167 | 157 | let DIR_SHORT = 2 | |
168 | 158 | ||
169 | 159 | let TWAP_INTERVAL = 15 | |
170 | 160 | ||
171 | 161 | let SECONDS = 1000 | |
172 | 162 | ||
173 | 163 | let DECIMAL_NUMBERS = 6 | |
174 | 164 | ||
175 | 165 | let DECIMAL_UNIT = (1 * (((((10 * 10) * 10) * 10) * 10) * 10)) | |
176 | 166 | ||
177 | 167 | let MINUTES_IN_YEAR = (525600 * DECIMAL_UNIT) | |
178 | 168 | ||
179 | 169 | let ONE_DAY = (86400 * DECIMAL_UNIT) | |
180 | 170 | ||
181 | 171 | let PNL_OPTION_SPOT = 1 | |
182 | 172 | ||
183 | 173 | let PNL_OPTION_ORACLE = 2 | |
184 | 174 | ||
185 | 175 | let FUNDING_ASYMMETRIC = 1 | |
186 | 176 | ||
187 | 177 | let FUNDING_SYMMETRIC = 2 | |
188 | 178 | ||
189 | 179 | func s (_x) = (toString(_x) + ",") | |
190 | 180 | ||
191 | 181 | ||
192 | 182 | func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN) | |
193 | 183 | ||
194 | 184 | ||
195 | 185 | func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN) | |
196 | 186 | ||
197 | 187 | ||
198 | 188 | func bdivd (_x,_y) = fraction(_x, toBigInt(DECIMAL_UNIT), _y, HALFEVEN) | |
199 | 189 | ||
200 | 190 | ||
201 | 191 | func bmuld (_x,_y) = fraction(_x, _y, toBigInt(DECIMAL_UNIT), HALFEVEN) | |
202 | 192 | ||
203 | 193 | ||
204 | 194 | func abs (_x) = if ((_x > 0)) | |
205 | 195 | then _x | |
206 | 196 | else -(_x) | |
207 | 197 | ||
208 | 198 | ||
209 | 199 | func vmax (_x,_y) = if ((_x >= _y)) | |
210 | 200 | then _x | |
211 | 201 | else _y | |
212 | 202 | ||
213 | 203 | ||
214 | 204 | func listToStr (_list) = if ((size(_list) == 0)) | |
215 | 205 | then "" | |
216 | 206 | else makeString(_list, ",") | |
217 | 207 | ||
218 | 208 | ||
219 | 209 | func strToList (_str) = if ((_str == "")) | |
220 | 210 | then nil | |
221 | 211 | else split(_str, ",") | |
222 | 212 | ||
223 | 213 | ||
224 | 214 | func pushToQueue (_list,_maxSize,_value) = if ((size(_list) > _maxSize)) | |
225 | 215 | then (removeByIndex(_list, 0) :+ _value) | |
226 | 216 | else (_list :+ _value) | |
227 | 217 | ||
228 | 218 | ||
229 | 219 | func int (k) = valueOrErrorMessage(getInteger(this, k), ("no value for " + k)) | |
230 | 220 | ||
231 | 221 | ||
232 | 222 | func intOr (k,def) = valueOrElse(getInteger(this, k), def) | |
233 | 223 | ||
234 | 224 | ||
235 | 225 | func strA (_address,_key) = { | |
236 | 226 | let val = valueOrErrorMessage(getString(_address, _key), ("No value for key " + _key)) | |
237 | 227 | val | |
238 | 228 | } | |
239 | 229 | ||
240 | 230 | ||
241 | 231 | func intA (_address,_key) = { | |
242 | 232 | let val = valueOrErrorMessage(getInteger(_address, _key), ("No value for key " + _key)) | |
243 | 233 | val | |
244 | 234 | } | |
245 | 235 | ||
246 | 236 | ||
247 | 237 | func cbalance () = int(k_balance) | |
248 | 238 | ||
249 | 239 | ||
250 | 240 | func fee () = int(k_fee) | |
251 | 241 | ||
252 | 242 | ||
253 | 243 | func rolloverFeeRate () = int(k_rolloverFee) | |
254 | 244 | ||
255 | 245 | ||
256 | 246 | func initMarginRatio () = int(k_initMarginRatio) | |
257 | 247 | ||
258 | 248 | ||
259 | 249 | func qtAstR () = int(k_quoteAssetReserve) | |
260 | 250 | ||
261 | 251 | ||
262 | 252 | func bsAstR () = int(k_baseAssetReserve) | |
263 | 253 | ||
264 | 254 | ||
265 | 255 | func qtAstW () = intOr(k_quoteAssetWeight, DECIMAL_UNIT) | |
266 | 256 | ||
267 | 257 | ||
268 | 258 | func bsAstW () = intOr(k_baseAssetWeight, DECIMAL_UNIT) | |
269 | 259 | ||
270 | 260 | ||
271 | 261 | func totalPositionSize () = int(k_totalPositionSize) | |
272 | 262 | ||
273 | 263 | ||
274 | 264 | func openInterestNotional () = int(k_openInterestNotional) | |
275 | 265 | ||
276 | 266 | ||
277 | 267 | func openInterestShort () = int(k_openInterestShort) | |
278 | 268 | ||
279 | 269 | ||
280 | 270 | func openInterestLong () = int(k_openInterestLong) | |
281 | 271 | ||
282 | 272 | ||
283 | 273 | func nextFundingBlockTimestamp () = int(k_nextFundingBlock) | |
284 | 274 | ||
285 | 275 | ||
286 | 276 | func fundingPeriodRaw () = int(k_fundingPeriod) | |
287 | 277 | ||
288 | 278 | ||
289 | 279 | func fundingPeriodDecimal () = (fundingPeriodRaw() * DECIMAL_UNIT) | |
290 | 280 | ||
291 | 281 | ||
292 | 282 | func fundingPeriodSeconds () = (fundingPeriodRaw() * SECONDS) | |
293 | 283 | ||
294 | 284 | ||
295 | 285 | func maintenanceMarginRatio () = int(k_maintenanceMarginRatio) | |
296 | 286 | ||
297 | 287 | ||
298 | 288 | func liquidationFeeRatio () = int(k_liquidationFeeRatio) | |
299 | 289 | ||
300 | 290 | ||
301 | 291 | func partialLiquidationRatio () = int(k_partialLiquidationRatio) | |
302 | 292 | ||
303 | 293 | ||
304 | 294 | func spreadLimit () = int(k_spreadLimit) | |
305 | 295 | ||
306 | 296 | ||
307 | 297 | func maxPriceImpact () = int(k_maxPriceImpact) | |
308 | 298 | ||
309 | 299 | ||
310 | 300 | func maxPriceSpread () = int(k_maxPriceSpread) | |
311 | 301 | ||
312 | 302 | ||
313 | 303 | func maxOpenNotional () = int(k_maxOpenNotional) | |
314 | 304 | ||
315 | 305 | ||
316 | 306 | func latestLongCumulativePremiumFraction () = int(k_latestLongCumulativePremiumFraction) | |
317 | 307 | ||
318 | 308 | ||
319 | 309 | func latestShortCumulativePremiumFraction () = int(k_latestShortCumulativePremiumFraction) | |
320 | 310 | ||
321 | 311 | ||
322 | 312 | func totalShortPositionSize () = int(k_totalShortPositionSize) | |
323 | 313 | ||
324 | 314 | ||
325 | 315 | func totalLongPositionSize () = int(k_totalLongPositionSize) | |
326 | 316 | ||
327 | 317 | ||
328 | 318 | func lastSequence () = intOr(k_sequence, 0) | |
329 | 319 | ||
330 | 320 | ||
331 | 321 | func feeToStakersPercent () = int(k_feeToStakersPercent) | |
332 | 322 | ||
333 | 323 | ||
334 | 324 | func maxOracleDelay () = int(k_maxOracleDelay) | |
335 | 325 | ||
336 | 326 | ||
337 | 327 | func fundingMode () = intOr(k_fundingMode, FUNDING_ASYMMETRIC) | |
338 | 328 | ||
339 | 329 | ||
340 | 330 | func lastTimestamp () = lastBlock.timestamp | |
341 | 331 | ||
342 | 332 | ||
343 | 333 | func getActualCaller (i) = valueOrElse(getString(ordersAddress(), "k_sender"), toString(i.caller)) | |
344 | 334 | ||
345 | 335 | ||
346 | 336 | func requireMoreMarginRatio (_marginRatio,_baseMarginRatio,_largerThanOrEqualTo) = { | |
347 | 337 | let remainingMarginRatio = (_marginRatio - _baseMarginRatio) | |
348 | 338 | if (if (_largerThanOrEqualTo) | |
349 | 339 | then (0 > remainingMarginRatio) | |
350 | 340 | else false) | |
351 | 341 | then throw(((("Invalid margin: " + toString(_marginRatio)) + " < ") + toString(_baseMarginRatio))) | |
352 | 342 | else if (if (!(_largerThanOrEqualTo)) | |
353 | 343 | then (remainingMarginRatio >= 0) | |
354 | 344 | else false) | |
355 | 345 | then throw(((("Invalid margin: " + toString(_marginRatio)) + " > ") + toString(_baseMarginRatio))) | |
356 | 346 | else true | |
357 | 347 | } | |
358 | 348 | ||
359 | 349 | ||
360 | 350 | func latestCumulativePremiumFraction (_positionSize) = if ((_positionSize == 0)) | |
361 | 351 | then throw("Should not be called with _positionSize == 0") | |
362 | 352 | else if ((_positionSize > 0)) | |
363 | 353 | then latestLongCumulativePremiumFraction() | |
364 | 354 | else latestShortCumulativePremiumFraction() | |
365 | 355 | ||
366 | 356 | ||
367 | 357 | func getPosition (_trader) = { | |
368 | 358 | let positionSizeOpt = getInteger(this, toCompositeKey(k_positionSize, _trader)) | |
369 | 359 | match positionSizeOpt { | |
370 | 360 | case positionSize: Int => | |
371 | 361 | $Tuple5(positionSize, getIntegerValue(this, toCompositeKey(k_positionMargin, _trader)), getIntegerValue(this, toCompositeKey(k_positionOpenNotional, _trader)), getIntegerValue(this, toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _trader)), getIntegerValue(this, toCompositeKey(k_positionLastUpdatedTimestamp, _trader))) | |
372 | 362 | case _ => | |
373 | 363 | $Tuple5(0, 0, 0, 0, 0) | |
374 | 364 | } | |
375 | 365 | } | |
376 | 366 | ||
377 | 367 | ||
378 | 368 | func getPositionAsset (_trader) = { | |
379 | 369 | let positionAssetOpt = getString(this, toCompositeKey(k_positionAsset, _trader)) | |
380 | 370 | match positionAssetOpt { | |
381 | 371 | case positionAsset: String => | |
382 | 372 | positionAsset | |
383 | 373 | case _ => | |
384 | 374 | toBase58String(quoteAsset()) | |
385 | 375 | } | |
386 | 376 | } | |
387 | 377 | ||
388 | 378 | ||
389 | 379 | func getPositionFee (_trader) = { | |
390 | 380 | let positionFeeOpt = getInteger(this, toCompositeKey(k_positionFee, _trader)) | |
391 | 381 | match positionFeeOpt { | |
392 | 382 | case positionFee: Int => | |
393 | 383 | positionFee | |
394 | 384 | case _ => | |
395 | 385 | fee() | |
396 | 386 | } | |
397 | 387 | } | |
398 | 388 | ||
399 | 389 | ||
400 | 390 | func requireOpenPosition (_trader) = if ((getPosition(_trader)._1 == 0)) | |
401 | 391 | then throw("No open position") | |
402 | 392 | else true | |
403 | 393 | ||
404 | 394 | ||
405 | 395 | func getOracleData (key) = { | |
406 | 396 | let oracleDataStr = getString(this, key) | |
407 | 397 | if (if (isDefined(oracleDataStr)) | |
408 | 398 | then (value(oracleDataStr) != "") | |
409 | 399 | else false) | |
410 | 400 | then { | |
411 | 401 | let oracleData = split(value(oracleDataStr), ",") | |
412 | 402 | let oracleAddress = valueOrErrorMessage(addressFromString(oracleData[0]), ("Invalid oracle address in: " + value(oracleDataStr))) | |
413 | 403 | let priceKey = oracleData[1] | |
414 | 404 | let blockKey = oracleData[2] | |
415 | 405 | let openKey = oracleData[3] | |
416 | 406 | $Tuple4(oracleAddress, priceKey, blockKey, openKey) | |
417 | 407 | } | |
418 | 408 | else unit | |
419 | 409 | } | |
420 | 410 | ||
421 | 411 | ||
422 | 412 | func initialized () = valueOrElse(getBoolean(this, k_initialized), false) | |
423 | 413 | ||
424 | 414 | ||
425 | 415 | func paused () = valueOrElse(getBoolean(this, k_paused), false) | |
426 | 416 | ||
427 | 417 | ||
428 | 418 | func closeOnly () = valueOrElse(getBoolean(this, k_closeOnly), false) | |
429 | 419 | ||
430 | 420 | ||
431 | 421 | func updateReserve (_isAdd,_quoteAssetAmount,_baseAssetAmount) = if (_isAdd) | |
432 | 422 | then { | |
433 | 423 | let newBase = (bsAstR() - _baseAssetAmount) | |
434 | 424 | if ((0 >= newBase)) | |
435 | 425 | then throw("Tx lead to base asset reserve <= 0, revert") | |
436 | 426 | else $Tuple3((qtAstR() + _quoteAssetAmount), newBase, (totalPositionSize() + _baseAssetAmount)) | |
437 | 427 | } | |
438 | 428 | else { | |
439 | 429 | let newQuote = (qtAstR() - _quoteAssetAmount) | |
440 | 430 | if ((0 >= newQuote)) | |
441 | 431 | then throw("Tx lead to base quote reserve <= 0, revert") | |
442 | 432 | else $Tuple3(newQuote, (bsAstR() + _baseAssetAmount), (totalPositionSize() - _baseAssetAmount)) | |
443 | 433 | } | |
444 | 434 | ||
445 | 435 | ||
446 | 436 | func calcInvariant (_qtAstR,_bsAstR) = { | |
447 | 437 | let bqtAstR = toBigInt(_qtAstR) | |
448 | 438 | let bbsAstR = toBigInt(_bsAstR) | |
449 | 439 | bmuld(bqtAstR, bbsAstR) | |
450 | 440 | } | |
451 | 441 | ||
452 | 442 | ||
453 | 443 | func swapInput (_isAdd,_quoteAssetAmount) = { | |
454 | 444 | let _qtAstR = qtAstR() | |
455 | 445 | let _bsAstR = bsAstR() | |
456 | 446 | let _qtAstW = qtAstW() | |
457 | 447 | let _bsAstW = bsAstW() | |
458 | 448 | let quoteAssetAmountAdjusted = divd(_quoteAssetAmount, _qtAstW) | |
459 | 449 | let k = calcInvariant(_qtAstR, _bsAstR) | |
460 | 450 | let quoteAssetReserveAfter = if (_isAdd) | |
461 | 451 | then (_qtAstR + quoteAssetAmountAdjusted) | |
462 | 452 | else (_qtAstR - quoteAssetAmountAdjusted) | |
463 | 453 | let baseAssetReserveAfter = toInt(bdivd(k, toBigInt(quoteAssetReserveAfter))) | |
464 | 454 | let amountBaseAssetBoughtAbs = abs((baseAssetReserveAfter - _bsAstR)) | |
465 | 455 | let amountBaseAssetBought = if (_isAdd) | |
466 | 456 | then amountBaseAssetBoughtAbs | |
467 | 457 | else -(amountBaseAssetBoughtAbs) | |
468 | - | let $ | |
469 | - | let quoteAssetReserveAfter1 = $ | |
470 | - | let baseAssetReserveAfter1 = $ | |
471 | - | let totalPositionSizeAfter1 = $ | |
458 | + | let $t01635216522 = updateReserve(_isAdd, quoteAssetAmountAdjusted, amountBaseAssetBoughtAbs) | |
459 | + | let quoteAssetReserveAfter1 = $t01635216522._1 | |
460 | + | let baseAssetReserveAfter1 = $t01635216522._2 | |
461 | + | let totalPositionSizeAfter1 = $t01635216522._3 | |
472 | 462 | let priceBefore = divd(muld(_qtAstR, _qtAstW), muld(_bsAstR, _bsAstW)) | |
473 | 463 | let marketPrice = divd(_quoteAssetAmount, amountBaseAssetBoughtAbs) | |
474 | 464 | let priceDiff = abs((priceBefore - marketPrice)) | |
475 | 465 | let priceImpact = (DECIMAL_UNIT - divd(priceBefore, (priceBefore + priceDiff))) | |
476 | 466 | let maxPriceImpactValue = maxPriceImpact() | |
477 | 467 | if ((priceImpact > maxPriceImpactValue)) | |
478 | 468 | then throw(((((((((((((("Price impact " + toString(priceImpact)) + " > max price impact ") + toString(maxPriceImpactValue)) + " before quote asset: ") + toString(_qtAstR)) + " before base asset: ") + toString(_bsAstR)) + " quote asset amount to exchange: ") + toString(_quoteAssetAmount)) + " price before: ") + toString(priceBefore)) + " marketPrice: ") + toString(marketPrice))) | |
479 | 469 | else $Tuple4(amountBaseAssetBought, quoteAssetReserveAfter1, baseAssetReserveAfter1, totalPositionSizeAfter1) | |
480 | 470 | } | |
481 | 471 | ||
482 | 472 | ||
483 | 473 | func calcRolloverFee (_oldPositionMargin,_oldPositionLastUpdatedTimestamp) = { | |
484 | 474 | let positionMinutes = ((((lastTimestamp() - _oldPositionLastUpdatedTimestamp) / 1000) / 60) * DECIMAL_UNIT) | |
485 | 475 | let rolloverFee = divd(muld(muld(_oldPositionMargin, positionMinutes), rolloverFeeRate()), MINUTES_IN_YEAR) | |
486 | 476 | rolloverFee | |
487 | 477 | } | |
488 | 478 | ||
489 | 479 | ||
490 | 480 | func calcRemainMarginWithFundingPaymentAndRolloverFee (_oldPositionSize,_oldPositionMargin,_oldPositionCumulativePremiumFraction,_oldPositionLastUpdatedTimestamp,_marginDelta) = { | |
491 | 481 | let fundingPayment = if ((_oldPositionSize != 0)) | |
492 | 482 | then { | |
493 | 483 | let _latestCumulativePremiumFraction = latestCumulativePremiumFraction(_oldPositionSize) | |
494 | 484 | muld((_latestCumulativePremiumFraction - _oldPositionCumulativePremiumFraction), _oldPositionSize) | |
495 | 485 | } | |
496 | 486 | else 0 | |
497 | 487 | let rolloverFee = calcRolloverFee(_oldPositionMargin, _oldPositionLastUpdatedTimestamp) | |
498 | 488 | let signedMargin = (((_marginDelta - rolloverFee) - fundingPayment) + _oldPositionMargin) | |
499 | - | let $ | |
489 | + | let $t01877718904 = if ((0 > signedMargin)) | |
500 | 490 | then $Tuple2(0, abs(signedMargin)) | |
501 | 491 | else $Tuple2(abs(signedMargin), 0) | |
502 | - | let remainMargin = $ | |
503 | - | let badDebt = $ | |
492 | + | let remainMargin = $t01877718904._1 | |
493 | + | let badDebt = $t01877718904._2 | |
504 | 494 | $Tuple4(remainMargin, badDebt, fundingPayment, rolloverFee) | |
505 | 495 | } | |
506 | 496 | ||
507 | 497 | ||
508 | 498 | func swapOutputWithReserves (_isAdd,_baseAssetAmount,_checkMaxPriceImpact,_quoteAssetReserve,_quoteAssetWeight,_baseAssetReserve,_baseAssetWeight) = { | |
509 | 499 | let priceBefore = divd(muld(_quoteAssetReserve, _quoteAssetWeight), muld(_baseAssetReserve, _baseAssetWeight)) | |
510 | 500 | if ((_baseAssetAmount == 0)) | |
511 | 501 | then throw("Invalid base asset amount") | |
512 | 502 | else { | |
513 | 503 | let k = calcInvariant(_quoteAssetReserve, _baseAssetReserve) | |
514 | 504 | let baseAssetPoolAmountAfter = if (_isAdd) | |
515 | 505 | then (_baseAssetReserve + _baseAssetAmount) | |
516 | 506 | else (_baseAssetReserve - _baseAssetAmount) | |
517 | 507 | let quoteAssetAfter = toInt(bdivd(k, toBigInt(baseAssetPoolAmountAfter))) | |
518 | 508 | let quoteAssetDelta = abs((quoteAssetAfter - _quoteAssetReserve)) | |
519 | 509 | let quoteAssetSold = muld(quoteAssetDelta, _quoteAssetWeight) | |
520 | 510 | let maxPriceImpactValue = maxPriceImpact() | |
521 | - | let $ | |
522 | - | let quoteAssetReserveAfter1 = $ | |
523 | - | let baseAssetReserveAfter1 = $ | |
524 | - | let totalPositionSizeAfter1 = $ | |
511 | + | let $t02016620328 = updateReserve(!(_isAdd), quoteAssetDelta, _baseAssetAmount) | |
512 | + | let quoteAssetReserveAfter1 = $t02016620328._1 | |
513 | + | let baseAssetReserveAfter1 = $t02016620328._2 | |
514 | + | let totalPositionSizeAfter1 = $t02016620328._3 | |
525 | 515 | let marketPrice = divd(quoteAssetSold, _baseAssetAmount) | |
526 | 516 | let priceDiff = abs((priceBefore - marketPrice)) | |
527 | 517 | let priceImpact = (DECIMAL_UNIT - divd(priceBefore, (priceBefore + priceDiff))) | |
528 | 518 | if (if ((priceImpact > maxPriceImpactValue)) | |
529 | 519 | then _checkMaxPriceImpact | |
530 | 520 | else false) | |
531 | 521 | then throw(((((((((((((("Price impact " + toString(priceImpact)) + " > max price impact ") + toString(maxPriceImpactValue)) + " before quote asset: ") + toString(_quoteAssetReserve)) + " before base asset: ") + toString(_baseAssetReserve)) + " base asset amount to exchange: ") + toString(_baseAssetAmount)) + " price before: ") + toString(priceBefore)) + " market price: ") + toString(marketPrice))) | |
532 | 522 | else $Tuple7(quoteAssetSold, quoteAssetReserveAfter1, baseAssetReserveAfter1, totalPositionSizeAfter1, (totalLongPositionSize() - (if (_isAdd) | |
533 | 523 | then abs(_baseAssetAmount) | |
534 | 524 | else 0)), (totalShortPositionSize() - (if (!(_isAdd)) | |
535 | 525 | then abs(_baseAssetAmount) | |
536 | 526 | else 0)), priceImpact) | |
537 | 527 | } | |
538 | 528 | } | |
539 | 529 | ||
540 | 530 | ||
541 | 531 | func swapOutput (_isAdd,_baseAssetAmount,_checkMaxPriceImpact) = swapOutputWithReserves(_isAdd, _baseAssetAmount, _checkMaxPriceImpact, qtAstR(), qtAstW(), bsAstR(), bsAstW()) | |
542 | 532 | ||
543 | 533 | ||
544 | 534 | func getOraclePriceValue (oracle,priceKey,blockKey) = { | |
545 | 535 | let lastValue = valueOrErrorMessage(getInteger(oracle, priceKey), ((("Can not get oracle price. Oracle: " + toString(oracle)) + " key: ") + priceKey)) | |
546 | 536 | if ((blockKey != "")) | |
547 | 537 | then { | |
548 | 538 | let currentBlock = lastBlock.height | |
549 | 539 | let lastOracleBlock = valueOrErrorMessage(getInteger(oracle, blockKey), ((("Can not get oracle block. Oracle: " + toString(oracle)) + " key: ") + blockKey)) | |
550 | 540 | if (((currentBlock - lastOracleBlock) > maxOracleDelay())) | |
551 | 541 | then throw(((("Oracle stale data. Last oracle block: " + toString(lastOracleBlock)) + " current block: ") + toString(currentBlock))) | |
552 | 542 | else lastValue | |
553 | 543 | } | |
554 | 544 | else lastValue | |
555 | 545 | } | |
556 | 546 | ||
557 | 547 | ||
558 | 548 | func getOraclePrice () = { | |
559 | 549 | let baseOracle = valueOrErrorMessage(getOracleData(k_baseOracle), "No base asset oracle data") | |
560 | 550 | let baseOraclePrice = getOraclePriceValue(baseOracle._1, baseOracle._2, baseOracle._3) | |
561 | 551 | let quoteOracle = getOracleData(k_quoteOracle) | |
562 | 552 | let quoteOraclePrice = if (isDefined(quoteOracle)) | |
563 | 553 | then { | |
564 | 554 | let quoteOracleV = value(quoteOracle) | |
565 | 555 | getOraclePriceValue(quoteOracleV._1, quoteOracleV._2, quoteOracleV._3) | |
566 | 556 | } | |
567 | 557 | else DECIMAL_UNIT | |
568 | 558 | divd(baseOraclePrice, quoteOraclePrice) | |
569 | 559 | } | |
570 | 560 | ||
571 | 561 | ||
572 | 562 | func isMarketClosed () = { | |
573 | 563 | let baseOracle = valueOrErrorMessage(getOracleData(k_baseOracle), "No base asset oracle data") | |
574 | 564 | let oracle = baseOracle._1 | |
575 | 565 | let openKey = baseOracle._4 | |
576 | 566 | if ((openKey != "")) | |
577 | 567 | then { | |
578 | 568 | let isOpen = valueOrErrorMessage(getBoolean(oracle, openKey), ((("Can not get oracle is open/closed. Oracle: " + toString(oracle)) + " key: ") + openKey)) | |
579 | 569 | !(isOpen) | |
580 | 570 | } | |
581 | 571 | else false | |
582 | 572 | } | |
583 | 573 | ||
584 | 574 | ||
585 | 575 | func absPriceDiff (_oraclePrice,_quoteAssetReserve,_baseAssetReserve,_qtAstW,_bsAstW) = { | |
586 | 576 | let priceAfter = divd(muld(_quoteAssetReserve, _qtAstW), muld(_baseAssetReserve, _bsAstW)) | |
587 | 577 | let averagePrice = divd((_oraclePrice + priceAfter), (2 * DECIMAL_UNIT)) | |
588 | 578 | let absPriceDiff = divd(abs((_oraclePrice - priceAfter)), averagePrice) | |
589 | 579 | absPriceDiff | |
590 | 580 | } | |
591 | 581 | ||
592 | 582 | ||
593 | 583 | func requireNotOverSpreadLimit (_quoteAssetReserve,_baseAssetReserve) = { | |
594 | 584 | let oraclePrice = getOraclePrice() | |
595 | 585 | let _qtAstW = qtAstW() | |
596 | 586 | let _bsAstW = bsAstW() | |
597 | 587 | let absPriceDiffBefore = absPriceDiff(oraclePrice, qtAstR(), bsAstR(), _qtAstW, _bsAstW) | |
598 | 588 | let absPriceDiffAfter = absPriceDiff(oraclePrice, _quoteAssetReserve, _baseAssetReserve, _qtAstW, _bsAstW) | |
599 | 589 | if (if ((absPriceDiffAfter > maxPriceSpread())) | |
600 | 590 | then (absPriceDiffAfter > absPriceDiffBefore) | |
601 | 591 | else false) | |
602 | 592 | then throw(((("Price spread " + toString(absPriceDiffAfter)) + " > max price spread ") + toString(maxPriceSpread()))) | |
603 | 593 | else true | |
604 | 594 | } | |
605 | 595 | ||
606 | 596 | ||
607 | 597 | func requireNotOverMaxOpenNotional (_longOpenNotional,_shortOpenNotional) = { | |
608 | 598 | let _maxOpenNotional = maxOpenNotional() | |
609 | 599 | if ((_longOpenNotional > _maxOpenNotional)) | |
610 | 600 | then throw(((("Long open notional " + toString(_longOpenNotional)) + " > max open notional ") + toString(_maxOpenNotional))) | |
611 | 601 | else if ((_shortOpenNotional > _maxOpenNotional)) | |
612 | 602 | then throw(((("Short open notional " + toString(_shortOpenNotional)) + " > max open notional ") + toString(_maxOpenNotional))) | |
613 | 603 | else true | |
614 | 604 | } | |
615 | 605 | ||
616 | 606 | ||
617 | 607 | func getSpotPrice () = { | |
618 | 608 | let _quoteAssetReserve = qtAstR() | |
619 | 609 | let _baseAssetReserve = bsAstR() | |
620 | 610 | let _qtAstW = qtAstW() | |
621 | 611 | let _bsAstW = bsAstW() | |
622 | 612 | divd(muld(_quoteAssetReserve, _qtAstW), muld(_baseAssetReserve, _bsAstW)) | |
623 | 613 | } | |
624 | 614 | ||
625 | 615 | ||
626 | 616 | func isOverFluctuationLimit () = { | |
627 | 617 | let oraclePrice = getOraclePrice() | |
628 | 618 | let currentPrice = getSpotPrice() | |
629 | 619 | (divd(abs((oraclePrice - currentPrice)), oraclePrice) > spreadLimit()) | |
630 | 620 | } | |
631 | 621 | ||
632 | 622 | ||
633 | 623 | func getPositionAdjustedOpenNotional (_positionSize,_option,_quoteAssetReserve,_quoteAssetWeight,_baseAssetReserve,_baseAssetWeight) = { | |
634 | 624 | let positionSizeAbs = abs(_positionSize) | |
635 | 625 | let isShort = (0 > _positionSize) | |
636 | 626 | let positionNotional = if ((_option == PNL_OPTION_SPOT)) | |
637 | 627 | then { | |
638 | 628 | let outPositionNotional = swapOutputWithReserves(!(isShort), positionSizeAbs, false, _quoteAssetReserve, _quoteAssetWeight, _baseAssetReserve, _baseAssetWeight)._1 | |
639 | 629 | outPositionNotional | |
640 | 630 | } | |
641 | 631 | else muld(positionSizeAbs, getOraclePrice()) | |
642 | 632 | positionNotional | |
643 | 633 | } | |
644 | 634 | ||
645 | 635 | ||
646 | 636 | func getPositionNotionalAndUnrealizedPnlByValues (_positionSize,_positionOpenNotional,_quoteAssetReserve,_quoteAssetWeight,_baseAssetReserve,_baseAssetWeight,_option) = if ((_positionSize == 0)) | |
647 | 637 | then throw("Invalid position size") | |
648 | 638 | else { | |
649 | 639 | let isShort = (0 > _positionSize) | |
650 | 640 | let positionNotional = getPositionAdjustedOpenNotional(_positionSize, _option, _quoteAssetReserve, _quoteAssetWeight, _baseAssetReserve, _baseAssetWeight) | |
651 | 641 | let unrealizedPnl = if (isShort) | |
652 | 642 | then (_positionOpenNotional - positionNotional) | |
653 | 643 | else (positionNotional - _positionOpenNotional) | |
654 | 644 | $Tuple2(positionNotional, unrealizedPnl) | |
655 | 645 | } | |
656 | 646 | ||
657 | 647 | ||
658 | 648 | func getPositionNotionalAndUnrealizedPnl (_trader,_option) = { | |
659 | - | let $ | |
660 | - | let positionSize = $ | |
661 | - | let positionMargin = $ | |
662 | - | let positionOpenNotional = $ | |
663 | - | let positionLstUpdCPF = $ | |
649 | + | let $t02820628334 = getPosition(_trader) | |
650 | + | let positionSize = $t02820628334._1 | |
651 | + | let positionMargin = $t02820628334._2 | |
652 | + | let positionOpenNotional = $t02820628334._3 | |
653 | + | let positionLstUpdCPF = $t02820628334._4 | |
664 | 654 | getPositionNotionalAndUnrealizedPnlByValues(positionSize, positionOpenNotional, qtAstR(), qtAstW(), bsAstR(), bsAstW(), _option) | |
665 | 655 | } | |
666 | 656 | ||
667 | 657 | ||
668 | 658 | func calcMarginRatio (_remainMargin,_badDebt,_positionNotional) = divd((_remainMargin - _badDebt), _positionNotional) | |
669 | 659 | ||
670 | 660 | ||
671 | 661 | func getMarginRatioByOption (_trader,_option) = { | |
672 | - | let $ | |
673 | - | let positionSize = $ | |
674 | - | let positionMargin = $ | |
675 | - | let pon = $ | |
676 | - | let positionLastUpdatedCPF = $ | |
677 | - | let positionTimestamp = $ | |
678 | - | let $ | |
679 | - | let positionNotional = $ | |
680 | - | let unrealizedPnl = $ | |
681 | - | let $ | |
682 | - | let remainMargin = $ | |
683 | - | let badDebt = $ | |
662 | + | let $t02884928990 = getPosition(_trader) | |
663 | + | let positionSize = $t02884928990._1 | |
664 | + | let positionMargin = $t02884928990._2 | |
665 | + | let pon = $t02884928990._3 | |
666 | + | let positionLastUpdatedCPF = $t02884928990._4 | |
667 | + | let positionTimestamp = $t02884928990._5 | |
668 | + | let $t02899629089 = getPositionNotionalAndUnrealizedPnl(_trader, _option) | |
669 | + | let positionNotional = $t02899629089._1 | |
670 | + | let unrealizedPnl = $t02899629089._2 | |
671 | + | let $t02909429306 = calcRemainMarginWithFundingPaymentAndRolloverFee(positionSize, positionMargin, positionLastUpdatedCPF, positionTimestamp, unrealizedPnl) | |
672 | + | let remainMargin = $t02909429306._1 | |
673 | + | let badDebt = $t02909429306._2 | |
684 | 674 | calcMarginRatio(remainMargin, badDebt, positionNotional) | |
685 | 675 | } | |
686 | 676 | ||
687 | 677 | ||
688 | 678 | func getMarginRatio (_trader) = getMarginRatioByOption(_trader, PNL_OPTION_SPOT) | |
689 | 679 | ||
690 | 680 | ||
691 | 681 | func getPartialLiquidationAmount (_trader,_positionSize) = { | |
692 | 682 | let maximumRatio = vmax(partialLiquidationRatio(), (DECIMAL_UNIT - divd(getMarginRatio(_trader), maintenanceMarginRatio()))) | |
693 | 683 | let maxExchangedPositionSize = muld(abs(_positionSize), maximumRatio) | |
694 | 684 | let swapResult = swapOutput((_positionSize > 0), maxExchangedPositionSize, false) | |
695 | 685 | let maxExchangedQuoteAssetAmount = swapResult._1 | |
696 | 686 | let priceImpact = swapResult._7 | |
697 | 687 | if ((maxPriceImpact() > priceImpact)) | |
698 | 688 | then maxExchangedPositionSize | |
699 | 689 | else muld(abs(_positionSize), partialLiquidationRatio()) | |
700 | 690 | } | |
701 | 691 | ||
702 | 692 | ||
703 | 693 | func internalClosePosition (_trader,_size,_fee,_minQuoteAssetAmount,_addToMargin,_checkMaxPriceImpact,_liquidate) = { | |
704 | - | let $ | |
705 | - | let oldPositionSize = $ | |
706 | - | let oldPositionMargin = $ | |
707 | - | let oldPositionOpenNotional = $ | |
708 | - | let oldPositionLstUpdCPF = $ | |
709 | - | let oldPositionTimestamp = $ | |
694 | + | let $t03037330529 = getPosition(_trader) | |
695 | + | let oldPositionSize = $t03037330529._1 | |
696 | + | let oldPositionMargin = $t03037330529._2 | |
697 | + | let oldPositionOpenNotional = $t03037330529._3 | |
698 | + | let oldPositionLstUpdCPF = $t03037330529._4 | |
699 | + | let oldPositionTimestamp = $t03037330529._5 | |
710 | 700 | let isLongPosition = (oldPositionSize > 0) | |
711 | 701 | let absOldPositionSize = abs(oldPositionSize) | |
712 | 702 | if (if ((absOldPositionSize >= _size)) | |
713 | 703 | then (_size > 0) | |
714 | 704 | else false) | |
715 | 705 | then { | |
716 | 706 | let isPartialClose = (absOldPositionSize > _size) | |
717 | - | let $ | |
718 | - | let exchangedQuoteAssetAmount = $ | |
719 | - | let quoteAssetReserveAfter = $ | |
720 | - | let baseAssetReserveAfter = $ | |
721 | - | let totalPositionSizeAfter = $ | |
707 | + | let $t03082131272 = swapOutput((oldPositionSize > 0), _size, _checkMaxPriceImpact) | |
708 | + | let exchangedQuoteAssetAmount = $t03082131272._1 | |
709 | + | let quoteAssetReserveAfter = $t03082131272._2 | |
710 | + | let baseAssetReserveAfter = $t03082131272._3 | |
711 | + | let totalPositionSizeAfter = $t03082131272._4 | |
722 | 712 | let exchangedPositionSize = if ((oldPositionSize > 0)) | |
723 | 713 | then -(_size) | |
724 | 714 | else _size | |
725 | - | let $ | |
726 | - | let oldPositionNotional = $ | |
727 | - | let unrealizedPnl = $ | |
715 | + | let $t03148731694 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT) | |
716 | + | let oldPositionNotional = $t03148731694._1 | |
717 | + | let unrealizedPnl = $t03148731694._2 | |
728 | 718 | let realizedRatio = divd(abs(exchangedPositionSize), absOldPositionSize) | |
729 | 719 | let realizedPnl = muld(unrealizedPnl, realizedRatio) | |
730 | - | let $ | |
731 | - | let remainMarginBefore = $ | |
732 | - | let x1 = $ | |
733 | - | let x2 = $ | |
734 | - | let rolloverFee = $ | |
720 | + | let $t03203532281 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, unrealizedPnl) | |
721 | + | let remainMarginBefore = $t03203532281._1 | |
722 | + | let x1 = $t03203532281._2 | |
723 | + | let x2 = $t03203532281._3 | |
724 | + | let rolloverFee = $t03203532281._4 | |
735 | 725 | let positionBadDebt = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, realizedPnl)._2 | |
736 | 726 | let realizedCloseFee = muld(muld(oldPositionNotional, realizedRatio), _fee) | |
737 | 727 | let unrealizedPnlAfter = (unrealizedPnl - realizedPnl) | |
738 | 728 | let remainOpenNotional = if ((oldPositionSize > 0)) | |
739 | 729 | then ((oldPositionNotional - exchangedQuoteAssetAmount) - unrealizedPnlAfter) | |
740 | 730 | else ((unrealizedPnlAfter + oldPositionNotional) - exchangedQuoteAssetAmount) | |
741 | 731 | let newPositionSize = (oldPositionSize + exchangedPositionSize) | |
742 | - | let $ | |
732 | + | let $t03368734073 = if ((newPositionSize == 0)) | |
743 | 733 | then $Tuple2(0, 0) | |
744 | 734 | else $Tuple2(abs(remainOpenNotional), latestCumulativePremiumFraction(newPositionSize)) | |
745 | - | let newPositionOpenNotional = $ | |
746 | - | let newPositionLstUpdCPF = $ | |
735 | + | let newPositionOpenNotional = $t03368734073._1 | |
736 | + | let newPositionLstUpdCPF = $t03368734073._2 | |
747 | 737 | let openNotionalDelta = (oldPositionOpenNotional - newPositionOpenNotional) | |
748 | 738 | let marginRatio = getMarginRatioByOption(_trader, PNL_OPTION_SPOT) | |
749 | 739 | let newPositionMarginWithSameRatio = if ((oldPositionSize > 0)) | |
750 | 740 | then (muld((newPositionOpenNotional + unrealizedPnlAfter), marginRatio) - unrealizedPnlAfter) | |
751 | 741 | else (muld((newPositionOpenNotional - unrealizedPnlAfter), marginRatio) - unrealizedPnlAfter) | |
752 | 742 | let marginToTraderRaw = ((remainMarginBefore - (newPositionMarginWithSameRatio + unrealizedPnlAfter)) - realizedCloseFee) | |
753 | 743 | let marginToTrader = if ((0 > marginToTraderRaw)) | |
754 | 744 | then if (_liquidate) | |
755 | 745 | then 0 | |
756 | 746 | else throw("Invalid internalClosePosition params: unable to pay fee") | |
757 | 747 | else marginToTraderRaw | |
758 | 748 | let newPositionMargin = if (_addToMargin) | |
759 | 749 | then (newPositionMarginWithSameRatio + marginToTrader) | |
760 | 750 | else newPositionMarginWithSameRatio | |
761 | 751 | if (if ((_minQuoteAssetAmount != 0)) | |
762 | 752 | then (_minQuoteAssetAmount > exchangedQuoteAssetAmount) | |
763 | 753 | else false) | |
764 | 754 | then throw(((("Limit error: " + toString(exchangedQuoteAssetAmount)) + " < ") + toString(_minQuoteAssetAmount))) | |
765 | 755 | else $Tuple17(newPositionSize, newPositionMargin, newPositionOpenNotional, newPositionLstUpdCPF, positionBadDebt, realizedPnl, if (if (_addToMargin) | |
766 | 756 | then isPartialClose | |
767 | 757 | else false) | |
768 | 758 | then 0 | |
769 | 759 | else marginToTrader, quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, (openInterestNotional() - openNotionalDelta), (totalLongPositionSize() - (if (isLongPosition) | |
770 | 760 | then abs(exchangedPositionSize) | |
771 | 761 | else 0)), (totalShortPositionSize() - (if (!(isLongPosition)) | |
772 | 762 | then abs(exchangedPositionSize) | |
773 | 763 | else 0)), (openInterestLong() - (if (isLongPosition) | |
774 | 764 | then openNotionalDelta | |
775 | 765 | else 0)), (openInterestShort() - (if (!(isLongPosition)) | |
776 | 766 | then openNotionalDelta | |
777 | 767 | else 0)), (realizedCloseFee + rolloverFee), exchangedQuoteAssetAmount) | |
778 | 768 | } | |
779 | 769 | else throw(((("Invalid internalClosePosition params: invalid position size: " + toString(_size)) + " max: ") + toString(absOldPositionSize))) | |
780 | 770 | } | |
781 | 771 | ||
782 | 772 | ||
783 | - | func getTwapSpotPrice () = { | |
784 | - | let minuteId = ((lastTimestamp() / 1000) / 60) | |
785 | - | let startMinuteId = (minuteId - TWAP_INTERVAL) | |
786 | - | let listStr = valueOrElse(getString(this, k_lastDataStr), "") | |
787 | - | let list = split(listStr, ",") | |
788 | - | func filterFn (accumulator,next) = if ((startMinuteId >= valueOrErrorMessage(parseInt(next), ("getTwapSpotPrice: invalid int: " + listStr)))) | |
789 | - | then (accumulator :+ parseIntValue(next)) | |
790 | - | else accumulator | |
791 | - | ||
792 | - | let listF = { | |
793 | - | let $l = list | |
794 | - | let $s = size($l) | |
795 | - | let $acc0 = nil | |
796 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
797 | - | then $a | |
798 | - | else filterFn($a, $l[$i]) | |
799 | - | ||
800 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
801 | - | then $a | |
802 | - | else throw("List size exceeds 20") | |
803 | - | ||
804 | - | $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) | |
805 | - | } | |
806 | - | let maxIndex = if ((size(listF) > 0)) | |
807 | - | then max(listF) | |
808 | - | else valueOrErrorMessage(parseInt(list[0]), ("getTwapSpotPrice: invalid int: " + listStr)) | |
809 | - | let lastMinuteId = valueOrElse(getInteger(this, k_lastMinuteId), 0) | |
810 | - | let endLastCumulativePrice = valueOrElse(getInteger(this, ((k_twapDataLastCumulativePrice + "_") + toString(lastMinuteId))), 0) | |
811 | - | let endLastPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(lastMinuteId))), 0) | |
812 | - | let nowCumulativePrice = (endLastCumulativePrice + ((minuteId - lastMinuteId) * endLastPrice)) | |
813 | - | let startLastCumulativePrice = valueOrElse(getInteger(this, ((k_twapDataLastCumulativePrice + "_") + toString(maxIndex))), 0) | |
814 | - | let startLastPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(maxIndex))), 0) | |
815 | - | let startCumulativePrice = (startLastCumulativePrice + ((startMinuteId - maxIndex) * startLastPrice)) | |
816 | - | ((nowCumulativePrice - startCumulativePrice) / TWAP_INTERVAL) | |
817 | - | } | |
818 | - | ||
819 | - | ||
820 | 773 | func getTerminalAmmState () = { | |
821 | 774 | let _positionSize = totalPositionSize() | |
822 | 775 | if ((_positionSize == 0)) | |
823 | 776 | then $Tuple2(qtAstR(), bsAstR()) | |
824 | 777 | else { | |
825 | 778 | let direction = (_positionSize > 0) | |
826 | - | let $ | |
827 | - | let currentNetMarketValue = $ | |
828 | - | let terminalQuoteAssetReserve = $ | |
829 | - | let terminalBaseAssetReserve = $ | |
779 | + | let $t03730837487 = swapOutput(direction, abs(_positionSize), false) | |
780 | + | let currentNetMarketValue = $t03730837487._1 | |
781 | + | let terminalQuoteAssetReserve = $t03730837487._2 | |
782 | + | let terminalBaseAssetReserve = $t03730837487._3 | |
830 | 783 | $Tuple2(terminalQuoteAssetReserve, terminalBaseAssetReserve) | |
831 | 784 | } | |
832 | 785 | } | |
833 | 786 | ||
834 | 787 | ||
835 | 788 | func getQuoteAssetWeight (baseAssetReserve,totalPositionSize,quoteAssetReserve,targetPrice) = { | |
836 | 789 | let b = toBigInt(baseAssetReserve) | |
837 | 790 | let sz = toBigInt(totalPositionSize) | |
838 | 791 | let q = toBigInt(quoteAssetReserve) | |
839 | 792 | let p = toBigInt(targetPrice) | |
840 | 793 | let k = bmuld(q, b) | |
841 | 794 | let newB = (b + sz) | |
842 | 795 | let newQ = bdivd(k, newB) | |
843 | 796 | let z = bdivd(newQ, newB) | |
844 | 797 | let result = bdivd(p, z) | |
845 | 798 | toInt(result) | |
846 | 799 | } | |
847 | 800 | ||
848 | 801 | ||
849 | 802 | func getSyncTerminalPrice (_terminalPrice,_qtAstR,_bsAstR) = { | |
850 | 803 | let _positionSize = totalPositionSize() | |
851 | 804 | if ((_positionSize == 0)) | |
852 | 805 | then { | |
853 | 806 | let newQtAstW = divd(muld(_terminalPrice, _bsAstR), _qtAstR) | |
854 | 807 | $Tuple3(newQtAstW, DECIMAL_UNIT, 0) | |
855 | 808 | } | |
856 | 809 | else { | |
857 | 810 | let direction = (_positionSize > 0) | |
858 | 811 | let currentNetMarketValue = swapOutput(direction, abs(_positionSize), false)._1 | |
859 | 812 | let newQtAstW = getQuoteAssetWeight(_bsAstR, _positionSize, _qtAstR, _terminalPrice) | |
860 | 813 | let newBsAstW = DECIMAL_UNIT | |
861 | 814 | let marginToVault = getPositionNotionalAndUnrealizedPnlByValues(_positionSize, currentNetMarketValue, _qtAstR, newQtAstW, _bsAstR, newBsAstW, PNL_OPTION_SPOT)._2 | |
862 | 815 | $Tuple3(newQtAstW, newBsAstW, marginToVault) | |
863 | 816 | } | |
864 | 817 | } | |
865 | 818 | ||
866 | 819 | ||
867 | 820 | func getFunding () = { | |
868 | 821 | let underlyingPrice = getOraclePrice() | |
869 | - | let spotTwapPrice = | |
822 | + | let spotTwapPrice = getSpotPrice() | |
870 | 823 | let premium = (spotTwapPrice - underlyingPrice) | |
871 | 824 | if (if (if ((totalShortPositionSize() == 0)) | |
872 | 825 | then true | |
873 | 826 | else (totalLongPositionSize() == 0)) | |
874 | 827 | then true | |
875 | 828 | else isMarketClosed()) | |
876 | 829 | then $Tuple3(0, 0, 0) | |
877 | 830 | else if ((0 > premium)) | |
878 | 831 | then { | |
879 | 832 | let shortPremiumFraction = divd(muld(premium, fundingPeriodDecimal()), ONE_DAY) | |
880 | 833 | if ((fundingMode() == FUNDING_ASYMMETRIC)) | |
881 | 834 | then { | |
882 | 835 | let longPremiumFraction = divd(muld(shortPremiumFraction, totalShortPositionSize()), totalLongPositionSize()) | |
883 | 836 | $Tuple3(shortPremiumFraction, longPremiumFraction, 0) | |
884 | 837 | } | |
885 | 838 | else { | |
886 | 839 | let shortTotalPremiumFraction = abs(muld(shortPremiumFraction, totalShortPositionSize())) | |
887 | 840 | let longTotalPremiumFraction = abs(muld(shortPremiumFraction, totalLongPositionSize())) | |
888 | 841 | let premiumToVault = (shortTotalPremiumFraction - longTotalPremiumFraction) | |
889 | 842 | $Tuple3(shortPremiumFraction, shortPremiumFraction, premiumToVault) | |
890 | 843 | } | |
891 | 844 | } | |
892 | 845 | else { | |
893 | 846 | let longPremiumFraction = divd(muld(premium, fundingPeriodDecimal()), ONE_DAY) | |
894 | 847 | if ((fundingMode() == FUNDING_ASYMMETRIC)) | |
895 | 848 | then { | |
896 | 849 | let shortPremiumFraction = divd(muld(longPremiumFraction, totalLongPositionSize()), totalShortPositionSize()) | |
897 | 850 | $Tuple3(shortPremiumFraction, longPremiumFraction, 0) | |
898 | 851 | } | |
899 | 852 | else { | |
900 | 853 | let longTotalPremiumFraction = abs(muld(longPremiumFraction, totalLongPositionSize())) | |
901 | 854 | let shortTotalPremiumFraction = abs(muld(longPremiumFraction, totalShortPositionSize())) | |
902 | 855 | let premiumToVault = (longTotalPremiumFraction - shortTotalPremiumFraction) | |
903 | 856 | $Tuple3(longPremiumFraction, longPremiumFraction, premiumToVault) | |
904 | 857 | } | |
905 | 858 | } | |
906 | 859 | } | |
907 | 860 | ||
908 | 861 | ||
909 | 862 | func getAdjustedFee (_artifactId,_baseFeeDiscount) = { | |
910 | 863 | let baseFeeRaw = fee() | |
911 | 864 | let baseFee = muld(baseFeeRaw, _baseFeeDiscount) | |
912 | - | let $ | |
865 | + | let $t04122941724 = if ((_artifactId != "")) | |
913 | 866 | then { | |
914 | 867 | let artifactKind = strA(nftManagerAddress(), toCompositeKey(k_token_type, _artifactId)) | |
915 | 868 | if ((artifactKind == FEE_REDUCTION_TOKEN_TYPE)) | |
916 | 869 | then { | |
917 | 870 | let reduction = intA(nftManagerAddress(), toCompositeKey(k_token_param, _artifactId)) | |
918 | 871 | let adjustedFee = muld(baseFee, reduction) | |
919 | 872 | $Tuple2(adjustedFee, true) | |
920 | 873 | } | |
921 | 874 | else throw("Invalid attached artifact") | |
922 | 875 | } | |
923 | 876 | else $Tuple2(baseFee, false) | |
924 | - | let adjustedFee = $ | |
925 | - | let burnArtifact = $ | |
877 | + | let adjustedFee = $t04122941724._1 | |
878 | + | let burnArtifact = $t04122941724._2 | |
926 | 879 | $Tuple2(adjustedFee, burnArtifact) | |
927 | 880 | } | |
928 | 881 | ||
929 | 882 | ||
930 | 883 | func isSameAssetOrNoPosition (_trader,_assetId) = { | |
931 | 884 | let oldPositionSize = getPosition(_trader)._1 | |
932 | 885 | if ((oldPositionSize == 0)) | |
933 | 886 | then true | |
934 | 887 | else (getPositionAsset(_trader) == _assetId) | |
935 | 888 | } | |
936 | 889 | ||
937 | 890 | ||
938 | 891 | func isSameAsset (_trader,_assetId) = (getPositionAsset(_trader) == _assetId) | |
939 | 892 | ||
940 | 893 | ||
941 | 894 | func getForTraderWithArtifact (_trader,_artifactId) = { | |
942 | 895 | let doGetFeeDiscount = invoke(minerAddress(), "computeFeeDiscount", [_trader], nil) | |
943 | 896 | if ((doGetFeeDiscount == doGetFeeDiscount)) | |
944 | 897 | then { | |
945 | 898 | let feeDiscount = match doGetFeeDiscount { | |
946 | 899 | case x: Int => | |
947 | 900 | x | |
948 | 901 | case _ => | |
949 | 902 | throw("Invalid computeFeeDiscount result") | |
950 | 903 | } | |
951 | - | let $ | |
952 | - | let adjustedFee = $ | |
953 | - | let burnArtifact = $ | |
904 | + | let $t04240442478 = getAdjustedFee(_artifactId, feeDiscount) | |
905 | + | let adjustedFee = $t04240442478._1 | |
906 | + | let burnArtifact = $t04240442478._2 | |
954 | 907 | $Tuple2(adjustedFee, burnArtifact) | |
955 | 908 | } | |
956 | 909 | else throw("Strict value is not equal to itself.") | |
957 | 910 | } | |
958 | 911 | ||
959 | 912 | ||
960 | 913 | func getArtifactId (i) = { | |
961 | 914 | let artifactId = if ((size(i.payments) > 1)) | |
962 | 915 | then toBase58String(valueOrErrorMessage(i.payments[1].assetId, "Invalid artifactId")) | |
963 | 916 | else "" | |
964 | 917 | artifactId | |
965 | 918 | } | |
966 | 919 | ||
967 | 920 | ||
968 | 921 | func distributeFee (_feeAmount) = { | |
969 | 922 | let feeToStakers = muld(_feeAmount, feeToStakersPercent()) | |
970 | 923 | let feeToVault = (_feeAmount - feeToStakers) | |
971 | 924 | $Tuple2(feeToStakers, feeToVault) | |
972 | 925 | } | |
973 | 926 | ||
974 | 927 | ||
975 | 928 | func updateSettings (_initMarginRatio,_mmr,_liquidationFeeRatio,_fundingPeriod,_fee,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread,_maxOpenNotional,_feeToStakersPercent,_maxOracleDelay,_rolloverFee,_fundingMode) = [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), IntegerEntry(k_partialLiquidationRatio, _partialLiquidationRatio), IntegerEntry(k_maxPriceSpread, _maxPriceSpread), IntegerEntry(k_maxOpenNotional, _maxOpenNotional), IntegerEntry(k_feeToStakersPercent, _feeToStakersPercent), IntegerEntry(k_maxOracleDelay, _feeToStakersPercent), IntegerEntry(k_rolloverFee, _rolloverFee), IntegerEntry(k_fundingMode, _fundingMode)] | |
976 | 929 | ||
977 | 930 | ||
978 | 931 | 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)] | |
979 | 932 | ||
980 | 933 | ||
981 | 934 | func incrementPositionSequenceNumber (_isNewPosition,_address) = if (_isNewPosition) | |
982 | 935 | then { | |
983 | 936 | let currentSequence = lastSequence() | |
984 | 937 | [IntegerEntry(toCompositeKey(k_positionSequence, _address), (currentSequence + 1)), IntegerEntry(k_sequence, (currentSequence + 1))] | |
985 | 938 | } | |
986 | 939 | else nil | |
987 | 940 | ||
988 | 941 | ||
989 | 942 | func updatePositionFee (_isNewPosition,_address,_fee) = if (_isNewPosition) | |
990 | 943 | then [IntegerEntry(toCompositeKey(k_positionFee, _address), _fee)] | |
991 | 944 | else nil | |
992 | 945 | ||
993 | 946 | ||
994 | 947 | func updatePosition (_address,_size,_margin,_openNotional,_latestCumulativePremiumFraction,_latestTimestamp) = [IntegerEntry(toCompositeKey(k_positionSize, _address), _size), IntegerEntry(toCompositeKey(k_positionMargin, _address), _margin), IntegerEntry(toCompositeKey(k_positionOpenNotional, _address), _openNotional), IntegerEntry(toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _address), _latestCumulativePremiumFraction), IntegerEntry(toCompositeKey(k_positionLastUpdatedTimestamp, _address), _latestTimestamp)] | |
995 | 948 | ||
996 | 949 | ||
997 | - | func appendTwap (_price) = { | |
998 | - | let minuteId = ((lastTimestamp() / 1000) / 60) | |
999 | - | let previousMinuteId = valueOrElse(getInteger(this, k_lastMinuteId), 0) | |
1000 | - | if ((previousMinuteId > minuteId)) | |
1001 | - | then throw("TWAP out-of-order") | |
1002 | - | else { | |
1003 | - | let lastMinuteId = if ((previousMinuteId == 0)) | |
1004 | - | then minuteId | |
1005 | - | else previousMinuteId | |
1006 | - | if ((minuteId > previousMinuteId)) | |
1007 | - | then { | |
1008 | - | let prevCumulativePrice = valueOrElse(getInteger(this, ((k_twapDataLastCumulativePrice + "_") + toString(previousMinuteId))), 0) | |
1009 | - | let prevPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(previousMinuteId))), _price) | |
1010 | - | let lastCumulativePrice = (prevCumulativePrice + ((minuteId - lastMinuteId) * prevPrice)) | |
1011 | - | let list = pushToQueue(strToList(valueOrElse(getString(this, k_lastDataStr), "")), TWAP_INTERVAL, toString(minuteId)) | |
1012 | - | [IntegerEntry(toCompositeKey(k_twapDataLastCumulativePrice, toString(minuteId)), lastCumulativePrice), IntegerEntry(toCompositeKey(k_twapDataLastPrice, toString(minuteId)), _price), IntegerEntry(toCompositeKey(k_twapDataPreviousMinuteId, toString(minuteId)), previousMinuteId), IntegerEntry(k_lastMinuteId, minuteId), StringEntry(k_lastDataStr, listToStr(list))] | |
1013 | - | } | |
1014 | - | else { | |
1015 | - | let twapDataPreviousMinuteId = valueOrElse(getInteger(this, toCompositeKey(k_twapDataPreviousMinuteId, toString(minuteId))), 0) | |
1016 | - | let prevCumulativePrice = valueOrElse(getInteger(this, toCompositeKey(k_twapDataLastCumulativePrice, toString(twapDataPreviousMinuteId))), 0) | |
1017 | - | let prevPrice = valueOrElse(getInteger(this, toCompositeKey(k_twapDataLastPrice, toString(twapDataPreviousMinuteId))), _price) | |
1018 | - | let lastCumulativePrice = (prevCumulativePrice + ((minuteId - twapDataPreviousMinuteId) * prevPrice)) | |
1019 | - | [IntegerEntry(toCompositeKey(k_twapDataLastCumulativePrice, toString(minuteId)), lastCumulativePrice), IntegerEntry(toCompositeKey(k_twapDataLastPrice, toString(minuteId)), _price)] | |
1020 | - | } | |
1021 | - | } | |
1022 | - | } | |
1023 | - | ||
1024 | - | ||
1025 | 950 | func updateAmmReserves (_qtAstR,_bsAstR) = [IntegerEntry(k_quoteAssetReserve, _qtAstR), IntegerEntry(k_baseAssetReserve, _bsAstR)] | |
1026 | 951 | ||
1027 | 952 | ||
1028 | 953 | func updateAmmWeights (_qtAstW,_bsAstW) = [IntegerEntry(k_quoteAssetWeight, _qtAstW), IntegerEntry(k_baseAssetWeight, _bsAstW)] | |
1029 | 954 | ||
1030 | 955 | ||
1031 | 956 | func updateAmm (_qtAstR,_bsAstR,_totalPositionSizeAfter,_openInterestNotional,_totalLongPositionSize,_totalShortPositionSize,_totalLongOpenNotional,_totalShortOpenNotional) = { | |
1032 | 957 | let _qtAstW = qtAstW() | |
1033 | 958 | let _bsAstW = bsAstW() | |
1034 | 959 | if (((_totalLongPositionSize - _totalShortPositionSize) != _totalPositionSizeAfter)) | |
1035 | 960 | then throw(((((("Invalid AMM state data: " + toString(_totalLongPositionSize)) + " + ") + toString(_totalShortPositionSize)) + " != ") + toString(_totalPositionSizeAfter))) | |
1036 | - | else | |
961 | + | else (updateAmmReserves(_qtAstR, _bsAstR) ++ [IntegerEntry(k_totalPositionSize, _totalPositionSizeAfter), IntegerEntry(k_openInterestNotional, _openInterestNotional), IntegerEntry(k_totalLongPositionSize, _totalLongPositionSize), IntegerEntry(k_totalShortPositionSize, _totalShortPositionSize), IntegerEntry(k_openInterestLong, _totalLongOpenNotional), IntegerEntry(k_openInterestShort, _totalShortOpenNotional)]) | |
1037 | 962 | } | |
1038 | 963 | ||
1039 | 964 | ||
1040 | 965 | func deletePosition (_address) = [DeleteEntry(toCompositeKey(k_positionSize, _address)), DeleteEntry(toCompositeKey(k_positionMargin, _address)), DeleteEntry(toCompositeKey(k_positionOpenNotional, _address)), DeleteEntry(toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _address)), DeleteEntry(toCompositeKey(k_positionAsset, _address)), DeleteEntry(toCompositeKey(k_positionFee, _address)), DeleteEntry(toCompositeKey(k_positionLastUpdatedTimestamp, _address))] | |
1041 | 966 | ||
1042 | 967 | ||
1043 | 968 | func withdraw (_address,_amount) = { | |
1044 | 969 | let balance = assetBalance(this, quoteAsset()) | |
1045 | 970 | if ((_amount > balance)) | |
1046 | 971 | then throw(((("Unable to withdraw " + toString(_amount)) + " from contract balance ") + toString(balance))) | |
1047 | 972 | else [ScriptTransfer(_address, _amount, quoteAsset())] | |
1048 | 973 | } | |
1049 | 974 | ||
1050 | 975 | ||
1051 | 976 | func updateBalance (i) = if ((0 > i)) | |
1052 | 977 | then throw("Balance") | |
1053 | 978 | else [IntegerEntry(k_balance, i)] | |
1054 | 979 | ||
1055 | 980 | ||
1056 | 981 | func transferFee (i) = [ScriptTransfer(stakingAddress(), i, quoteAsset())] | |
1057 | 982 | ||
1058 | 983 | ||
1059 | 984 | func doBurnArtifact (_burnArtifact,i) = if (_burnArtifact) | |
1060 | 985 | then [Burn(valueOrErrorMessage(i.payments[1].assetId, "Invalid artifact"), 1)] | |
1061 | 986 | else nil | |
1062 | 987 | ||
1063 | 988 | ||
1064 | 989 | @Callable(i) | |
1065 | 990 | func pause () = if ((i.caller != adminAddress())) | |
1066 | 991 | then throw("Invalid pause params") | |
1067 | 992 | else [BooleanEntry(k_paused, true)] | |
1068 | 993 | ||
1069 | 994 | ||
1070 | 995 | ||
1071 | 996 | @Callable(i) | |
1072 | 997 | func unpause () = if ((i.caller != adminAddress())) | |
1073 | 998 | then throw("Invalid unpause params") | |
1074 | 999 | else [BooleanEntry(k_paused, false)] | |
1075 | 1000 | ||
1076 | 1001 | ||
1077 | 1002 | ||
1078 | 1003 | @Callable(i) | |
1079 | 1004 | func setCloseOnly () = if ((i.caller != adminAddress())) | |
1080 | 1005 | then throw("Invalid setCloseOnly params") | |
1081 | 1006 | else [BooleanEntry(k_closeOnly, true)] | |
1082 | 1007 | ||
1083 | 1008 | ||
1084 | 1009 | ||
1085 | 1010 | @Callable(i) | |
1086 | 1011 | func unsetCloseOnly () = if ((i.caller != adminAddress())) | |
1087 | 1012 | then throw("Invalid unsetCloseOnly params") | |
1088 | 1013 | else [BooleanEntry(k_closeOnly, false)] | |
1089 | 1014 | ||
1090 | 1015 | ||
1091 | 1016 | ||
1092 | 1017 | @Callable(i) | |
1093 | 1018 | func addLiquidity (_quoteAssetAmount) = if (if ((i.caller != adminAddress())) | |
1094 | 1019 | then true | |
1095 | 1020 | else (0 >= _quoteAssetAmount)) | |
1096 | 1021 | then throw("Invalid addLiquidity params") | |
1097 | 1022 | else { | |
1098 | 1023 | let _qtAstR = qtAstR() | |
1099 | 1024 | let _bsAstR = bsAstR() | |
1100 | 1025 | let _qtAstW = qtAstW() | |
1101 | 1026 | let _bsAstW = bsAstW() | |
1102 | 1027 | let price = divd(muld(_qtAstR, _qtAstW), muld(_bsAstR, _bsAstW)) | |
1103 | 1028 | let qtAstRAfter = (_qtAstR + _quoteAssetAmount) | |
1104 | 1029 | let baseAssetAmountToAdd = (divd(muld(qtAstRAfter, _qtAstW), price) - _bsAstR) | |
1105 | 1030 | let bsAstRAfter = (_bsAstR + baseAssetAmountToAdd) | |
1106 | - | let $ | |
1107 | - | let newQuoteAssetWeight = $ | |
1108 | - | let newBaseAssetWeight = $ | |
1109 | - | let marginToVault = $ | |
1031 | + | let $t05043150582 = getSyncTerminalPrice(getOraclePrice(), qtAstRAfter, bsAstRAfter) | |
1032 | + | let newQuoteAssetWeight = $t05043150582._1 | |
1033 | + | let newBaseAssetWeight = $t05043150582._2 | |
1034 | + | let marginToVault = $t05043150582._3 | |
1110 | 1035 | let doExchangePnL = if ((marginToVault != 0)) | |
1111 | 1036 | then { | |
1112 | 1037 | let doExchangePnL = invoke(vaultAddress(), "exchangeFreeAndLocked", [marginToVault], nil) | |
1113 | 1038 | if ((doExchangePnL == doExchangePnL)) | |
1114 | 1039 | then nil | |
1115 | 1040 | else throw("Strict value is not equal to itself.") | |
1116 | 1041 | } | |
1117 | 1042 | else nil | |
1118 | 1043 | if ((doExchangePnL == doExchangePnL)) | |
1119 | 1044 | then (updateAmmReserves(qtAstRAfter, bsAstRAfter) ++ updateAmmWeights(newQuoteAssetWeight, newBaseAssetWeight)) | |
1120 | 1045 | else throw("Strict value is not equal to itself.") | |
1121 | 1046 | } | |
1122 | 1047 | ||
1123 | 1048 | ||
1124 | 1049 | ||
1125 | 1050 | @Callable(i) | |
1126 | 1051 | func removeLiquidity (_quoteAssetAmount) = if (if ((i.caller != adminAddress())) | |
1127 | 1052 | then true | |
1128 | 1053 | else (_quoteAssetAmount >= 0)) | |
1129 | 1054 | then throw("Invalid removeLiquidity params") | |
1130 | 1055 | else { | |
1131 | 1056 | let _qtAstR = qtAstR() | |
1132 | 1057 | let _bsAstR = bsAstR() | |
1133 | 1058 | let _qtAstW = qtAstW() | |
1134 | 1059 | let _bsAstW = bsAstW() | |
1135 | 1060 | let price = divd(muld(_qtAstR, _qtAstW), muld(_bsAstR, _bsAstW)) | |
1136 | 1061 | let qtAstRAfter = (_qtAstR - _quoteAssetAmount) | |
1137 | 1062 | let baseAssetAmountToRemove = abs((divd(muld(qtAstRAfter, _qtAstW), price) - _bsAstR)) | |
1138 | 1063 | let bsAstRAfter = (_bsAstR - baseAssetAmountToRemove) | |
1139 | - | let $ | |
1140 | - | let newQuoteAssetWeight = $ | |
1141 | - | let newBaseAssetWeight = $ | |
1142 | - | let marginToVault = $ | |
1064 | + | let $t05167851829 = getSyncTerminalPrice(getOraclePrice(), qtAstRAfter, bsAstRAfter) | |
1065 | + | let newQuoteAssetWeight = $t05167851829._1 | |
1066 | + | let newBaseAssetWeight = $t05167851829._2 | |
1067 | + | let marginToVault = $t05167851829._3 | |
1143 | 1068 | let doExchangePnL = if ((marginToVault != 0)) | |
1144 | 1069 | then { | |
1145 | 1070 | let doExchangePnL = invoke(vaultAddress(), "exchangeFreeAndLocked", [marginToVault], nil) | |
1146 | 1071 | if ((doExchangePnL == doExchangePnL)) | |
1147 | 1072 | then nil | |
1148 | 1073 | else throw("Strict value is not equal to itself.") | |
1149 | 1074 | } | |
1150 | 1075 | else nil | |
1151 | 1076 | if ((doExchangePnL == doExchangePnL)) | |
1152 | 1077 | then (updateAmmReserves(qtAstRAfter, bsAstRAfter) ++ updateAmmWeights(newQuoteAssetWeight, newBaseAssetWeight)) | |
1153 | 1078 | else throw("Strict value is not equal to itself.") | |
1154 | 1079 | } | |
1155 | 1080 | ||
1156 | 1081 | ||
1157 | 1082 | ||
1158 | 1083 | @Callable(i) | |
1159 | 1084 | func changeSettings (_initMarginRatio,_mmr,_liquidationFeeRatio,_fundingPeriod,_fee,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread,_maxOpenNotional,_feeToStakersPercent,_maxOracleDelay,_rolloverFee,_fundingMode) = if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if ((0 >= _fundingPeriod)) | |
1160 | 1085 | then true | |
1161 | 1086 | else (0 >= _initMarginRatio)) | |
1162 | 1087 | then true | |
1163 | 1088 | else (0 >= _mmr)) | |
1164 | 1089 | then true | |
1165 | 1090 | else (0 >= _liquidationFeeRatio)) | |
1166 | 1091 | then true | |
1167 | 1092 | else (0 >= _fee)) | |
1168 | 1093 | then true | |
1169 | 1094 | else (0 >= _spreadLimit)) | |
1170 | 1095 | then true | |
1171 | 1096 | else (0 >= _maxPriceImpact)) | |
1172 | 1097 | then true | |
1173 | 1098 | else (0 >= _partialLiquidationRatio)) | |
1174 | 1099 | then true | |
1175 | 1100 | else (0 >= _maxPriceSpread)) | |
1176 | 1101 | then true | |
1177 | 1102 | else (0 >= _maxOpenNotional)) | |
1178 | 1103 | then true | |
1179 | 1104 | else (0 >= _feeToStakersPercent)) | |
1180 | 1105 | then true | |
1181 | 1106 | else (_feeToStakersPercent > DECIMAL_UNIT)) | |
1182 | 1107 | then true | |
1183 | 1108 | else (0 >= _maxOracleDelay)) | |
1184 | 1109 | then true | |
1185 | 1110 | else (0 >= _rolloverFee)) | |
1186 | 1111 | then true | |
1187 | 1112 | else if ((_fundingMode != FUNDING_SYMMETRIC)) | |
1188 | 1113 | then (_fundingMode != FUNDING_ASYMMETRIC) | |
1189 | 1114 | else false) | |
1190 | 1115 | then true | |
1191 | 1116 | else !(initialized())) | |
1192 | 1117 | then true | |
1193 | 1118 | else (i.caller != adminAddress())) | |
1194 | 1119 | then throw("Invalid changeSettings params") | |
1195 | 1120 | else updateSettings(_initMarginRatio, _mmr, _liquidationFeeRatio, _fundingPeriod, _fee, _spreadLimit, _maxPriceImpact, _partialLiquidationRatio, _maxPriceSpread, _maxOpenNotional, _feeToStakersPercent, _maxOracleDelay, _rolloverFee, _fundingMode) | |
1196 | 1121 | ||
1197 | 1122 | ||
1198 | 1123 | ||
1199 | 1124 | @Callable(i) | |
1200 | 1125 | func initialize (_qtAstR,_bsAstR,_fundingPeriod,_initMarginRatio,_mmr,_liquidationFeeRatio,_fee,_baseOracleData,_quoteOracleData,_coordinator,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread,_maxOpenNotional,_feeToStakersPercent,_maxOracleDelay,_rolloverFee,_fundingMode) = if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if ((0 >= _qtAstR)) | |
1201 | 1126 | then true | |
1202 | 1127 | else (0 >= _bsAstR)) | |
1203 | 1128 | then true | |
1204 | 1129 | else (0 >= _fundingPeriod)) | |
1205 | 1130 | then true | |
1206 | 1131 | else (0 >= _initMarginRatio)) | |
1207 | 1132 | then true | |
1208 | 1133 | else (0 >= _mmr)) | |
1209 | 1134 | then true | |
1210 | 1135 | else (0 >= _liquidationFeeRatio)) | |
1211 | 1136 | then true | |
1212 | 1137 | else (0 >= _fee)) | |
1213 | 1138 | then true | |
1214 | 1139 | else (0 >= _spreadLimit)) | |
1215 | 1140 | then true | |
1216 | 1141 | else (0 >= _maxPriceImpact)) | |
1217 | 1142 | then true | |
1218 | 1143 | else (0 >= _partialLiquidationRatio)) | |
1219 | 1144 | then true | |
1220 | 1145 | else (0 >= _maxPriceSpread)) | |
1221 | 1146 | then true | |
1222 | 1147 | else (0 >= _maxOpenNotional)) | |
1223 | 1148 | then true | |
1224 | 1149 | else (0 >= _feeToStakersPercent)) | |
1225 | 1150 | then true | |
1226 | 1151 | else (_feeToStakersPercent > DECIMAL_UNIT)) | |
1227 | 1152 | then true | |
1228 | 1153 | else (0 >= _maxOracleDelay)) | |
1229 | 1154 | then true | |
1230 | 1155 | else (0 >= _rolloverFee)) | |
1231 | 1156 | then true | |
1232 | 1157 | else if ((_fundingMode != FUNDING_SYMMETRIC)) | |
1233 | 1158 | then (_fundingMode != FUNDING_ASYMMETRIC) | |
1234 | 1159 | else false) | |
1235 | 1160 | then true | |
1236 | 1161 | else initialized()) | |
1237 | 1162 | then true | |
1238 | 1163 | else (i.caller != this)) | |
1239 | 1164 | then throw("Invalid initialize parameters") | |
1240 | 1165 | else ((((updateAmm(_qtAstR, _bsAstR, 0, 0, 0, 0, 0, 0) ++ updateSettings(_initMarginRatio, _mmr, _liquidationFeeRatio, _fundingPeriod, _fee, _spreadLimit, _maxPriceImpact, _partialLiquidationRatio, _maxPriceSpread, _maxOpenNotional, _feeToStakersPercent, _maxOracleDelay, _rolloverFee, _fundingMode)) ++ updateFunding((lastTimestamp() + _fundingPeriod), 0, 0, 0, 0)) ++ updateBalance(0)) ++ [BooleanEntry(k_initialized, true), StringEntry(k_baseOracle, _baseOracleData), StringEntry(k_quoteOracle, _quoteOracleData), StringEntry(k_coordinatorAddress, toString(addressFromStringValue(_coordinator)))]) | |
1241 | 1166 | ||
1242 | 1167 | ||
1243 | 1168 | ||
1244 | 1169 | @Callable(i) | |
1245 | 1170 | func increasePosition (_direction,_leverage,_minBaseAssetAmount,_refLink) = { | |
1246 | 1171 | let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1247 | 1172 | if ((sync == sync)) | |
1248 | 1173 | then { | |
1249 | 1174 | let ensureCalledOnce = invoke(this, "ensureCalledOnce", nil, nil) | |
1250 | 1175 | if ((ensureCalledOnce == ensureCalledOnce)) | |
1251 | 1176 | then { | |
1252 | 1177 | let _trader = getActualCaller(i) | |
1253 | 1178 | let _rawAmount = i.payments[0].amount | |
1254 | 1179 | let _assetId = i.payments[0].assetId | |
1255 | 1180 | let _assetIdStr = toBase58String(value(_assetId)) | |
1256 | 1181 | let isQuoteAsset = (_assetId == quoteAsset()) | |
1257 | 1182 | if (if (if (if (if (if (if (if (if (if ((_direction != DIR_LONG)) | |
1258 | 1183 | then (_direction != DIR_SHORT) | |
1259 | 1184 | else false) | |
1260 | 1185 | then true | |
1261 | 1186 | else (0 >= _rawAmount)) | |
1262 | 1187 | then true | |
1263 | 1188 | else !(initialized())) | |
1264 | 1189 | then true | |
1265 | 1190 | else !(isQuoteAsset)) | |
1266 | 1191 | then true | |
1267 | 1192 | else !(isSameAssetOrNoPosition(_trader, _assetIdStr))) | |
1268 | 1193 | then true | |
1269 | 1194 | else !(requireMoreMarginRatio(divd(DECIMAL_UNIT, _leverage), initMarginRatio(), true))) | |
1270 | 1195 | then true | |
1271 | 1196 | else paused()) | |
1272 | 1197 | then true | |
1273 | 1198 | else closeOnly()) | |
1274 | 1199 | then true | |
1275 | 1200 | else isMarketClosed()) | |
1276 | 1201 | then throw("Invalid increasePosition parameters") | |
1277 | 1202 | else { | |
1278 | - | let $ | |
1279 | - | let adjustedFee = $ | |
1280 | - | let burnArtifact = $ | |
1203 | + | let $t05795358102 = getForTraderWithArtifact(_trader, getArtifactId(i)) | |
1204 | + | let adjustedFee = $t05795358102._1 | |
1205 | + | let burnArtifact = $t05795358102._2 | |
1281 | 1206 | let _amount = divd(_rawAmount, (muld(adjustedFee, _leverage) + DECIMAL_UNIT)) | |
1282 | 1207 | let distributeFeeAmount = (_rawAmount - _amount) | |
1283 | 1208 | let referrerFeeAny = invoke(referralAddress(), "acceptPaymentWithLink", [_trader, _refLink], [AttachedPayment(quoteAsset(), distributeFeeAmount)]) | |
1284 | 1209 | if ((referrerFeeAny == referrerFeeAny)) | |
1285 | 1210 | then { | |
1286 | 1211 | let referrerFee = match referrerFeeAny { | |
1287 | 1212 | case x: Int => | |
1288 | 1213 | x | |
1289 | 1214 | case _ => | |
1290 | 1215 | throw("Invalid referrerFee") | |
1291 | 1216 | } | |
1292 | 1217 | let feeAmount = (distributeFeeAmount - referrerFee) | |
1293 | - | let $ | |
1294 | - | let oldPositionSize = $ | |
1295 | - | let oldPositionMargin = $ | |
1296 | - | let oldPositionOpenNotional = $ | |
1297 | - | let oldPositionLstUpdCPF = $ | |
1298 | - | let oldPositionTimestamp = $ | |
1218 | + | let $t05859858766 = getPosition(_trader) | |
1219 | + | let oldPositionSize = $t05859858766._1 | |
1220 | + | let oldPositionMargin = $t05859858766._2 | |
1221 | + | let oldPositionOpenNotional = $t05859858766._3 | |
1222 | + | let oldPositionLstUpdCPF = $t05859858766._4 | |
1223 | + | let oldPositionTimestamp = $t05859858766._5 | |
1299 | 1224 | let isNewPosition = (oldPositionSize == 0) | |
1300 | 1225 | let isSameDirection = if ((oldPositionSize > 0)) | |
1301 | 1226 | then (_direction == DIR_LONG) | |
1302 | 1227 | else (_direction == DIR_SHORT) | |
1303 | 1228 | let expandExisting = if (!(isNewPosition)) | |
1304 | 1229 | then isSameDirection | |
1305 | 1230 | else false | |
1306 | 1231 | let isAdd = (_direction == DIR_LONG) | |
1307 | - | let $ | |
1232 | + | let $t05905562176 = if (if (isNewPosition) | |
1308 | 1233 | then true | |
1309 | 1234 | else expandExisting) | |
1310 | 1235 | then { | |
1311 | 1236 | let openNotional = muld(_amount, _leverage) | |
1312 | - | let $ | |
1313 | - | let amountBaseAssetBought = $ | |
1314 | - | let quoteAssetReserveAfter = $ | |
1315 | - | let baseAssetReserveAfter = $ | |
1316 | - | let totalPositionSizeAfter = $ | |
1237 | + | let $t05956459737 = swapInput(isAdd, openNotional) | |
1238 | + | let amountBaseAssetBought = $t05956459737._1 | |
1239 | + | let quoteAssetReserveAfter = $t05956459737._2 | |
1240 | + | let baseAssetReserveAfter = $t05956459737._3 | |
1241 | + | let totalPositionSizeAfter = $t05956459737._4 | |
1317 | 1242 | if (if ((_minBaseAssetAmount != 0)) | |
1318 | 1243 | then (_minBaseAssetAmount > abs(amountBaseAssetBought)) | |
1319 | 1244 | else false) | |
1320 | 1245 | then throw(((("Limit error: " + toString(abs(amountBaseAssetBought))) + " < ") + toString(_minBaseAssetAmount))) | |
1321 | 1246 | else { | |
1322 | 1247 | let newPositionSize = (oldPositionSize + amountBaseAssetBought) | |
1323 | 1248 | let totalLongOpenInterestAfter = (openInterestLong() + (if ((newPositionSize > 0)) | |
1324 | 1249 | then openNotional | |
1325 | 1250 | else 0)) | |
1326 | 1251 | let totalShortOpenInterestAfter = (openInterestShort() + (if ((0 > newPositionSize)) | |
1327 | 1252 | then openNotional | |
1328 | 1253 | else 0)) | |
1329 | - | let $ | |
1330 | - | let remainMargin = $ | |
1331 | - | let x1 = $ | |
1332 | - | let x2 = $ | |
1333 | - | let rolloverFee = $ | |
1254 | + | let $t06028360558 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, _amount) | |
1255 | + | let remainMargin = $t06028360558._1 | |
1256 | + | let x1 = $t06028360558._2 | |
1257 | + | let x2 = $t06028360558._3 | |
1258 | + | let rolloverFee = $t06028360558._4 | |
1334 | 1259 | if (!(requireNotOverSpreadLimit(quoteAssetReserveAfter, baseAssetReserveAfter))) | |
1335 | 1260 | then throw("Over max spread limit") | |
1336 | 1261 | else if (!(requireNotOverMaxOpenNotional(totalLongOpenInterestAfter, totalShortOpenInterestAfter))) | |
1337 | 1262 | then throw("Over max open notional") | |
1338 | 1263 | else $Tuple14(newPositionSize, remainMargin, (oldPositionOpenNotional + openNotional), latestCumulativePremiumFraction(newPositionSize), lastTimestamp(), baseAssetReserveAfter, quoteAssetReserveAfter, totalPositionSizeAfter, (openInterestNotional() + openNotional), (totalLongPositionSize() + (if ((newPositionSize > 0)) | |
1339 | 1264 | then abs(amountBaseAssetBought) | |
1340 | 1265 | else 0)), (totalShortPositionSize() + (if ((0 > newPositionSize)) | |
1341 | 1266 | then abs(amountBaseAssetBought) | |
1342 | 1267 | else 0)), totalLongOpenInterestAfter, totalShortOpenInterestAfter, rolloverFee) | |
1343 | 1268 | } | |
1344 | 1269 | } | |
1345 | 1270 | else { | |
1346 | 1271 | let openNotional = muld(_amount, _leverage) | |
1347 | - | let $ | |
1348 | - | let oldPositionNotional = $ | |
1349 | - | let unrealizedPnl = $ | |
1272 | + | let $t06187661992 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT) | |
1273 | + | let oldPositionNotional = $t06187661992._1 | |
1274 | + | let unrealizedPnl = $t06187661992._2 | |
1350 | 1275 | if ((oldPositionNotional > openNotional)) | |
1351 | 1276 | then throw("Use decreasePosition to decrease position size") | |
1352 | 1277 | else throw("Close position first") | |
1353 | 1278 | } | |
1354 | - | let newPositionSize = $ | |
1355 | - | let newPositionRemainMargin = $ | |
1356 | - | let newPositionOpenNotional = $ | |
1357 | - | let newPositionLatestCPF = $ | |
1358 | - | let newPositionTimestamp = $ | |
1359 | - | let baseAssetReserveAfter = $ | |
1360 | - | let quoteAssetReserveAfter = $ | |
1361 | - | let totalPositionSizeAfter = $ | |
1362 | - | let openInterestNotionalAfter = $ | |
1363 | - | let totalLongAfter = $ | |
1364 | - | let totalShortAfter = $ | |
1365 | - | let totalLongOpenInterestAfter = $ | |
1366 | - | let totalShortOpenInterestAfter = $ | |
1367 | - | let rolloverFee = $ | |
1368 | - | let $ | |
1369 | - | let feeToStakers = $ | |
1370 | - | let feeToVault = $ | |
1279 | + | let newPositionSize = $t05905562176._1 | |
1280 | + | let newPositionRemainMargin = $t05905562176._2 | |
1281 | + | let newPositionOpenNotional = $t05905562176._3 | |
1282 | + | let newPositionLatestCPF = $t05905562176._4 | |
1283 | + | let newPositionTimestamp = $t05905562176._5 | |
1284 | + | let baseAssetReserveAfter = $t05905562176._6 | |
1285 | + | let quoteAssetReserveAfter = $t05905562176._7 | |
1286 | + | let totalPositionSizeAfter = $t05905562176._8 | |
1287 | + | let openInterestNotionalAfter = $t05905562176._9 | |
1288 | + | let totalLongAfter = $t05905562176._10 | |
1289 | + | let totalShortAfter = $t05905562176._11 | |
1290 | + | let totalLongOpenInterestAfter = $t05905562176._12 | |
1291 | + | let totalShortOpenInterestAfter = $t05905562176._13 | |
1292 | + | let rolloverFee = $t05905562176._14 | |
1293 | + | let $t06218262253 = distributeFee((feeAmount + rolloverFee)) | |
1294 | + | let feeToStakers = $t06218262253._1 | |
1295 | + | let feeToVault = $t06218262253._2 | |
1371 | 1296 | let stake = if ((_amount >= rolloverFee)) | |
1372 | 1297 | then invoke(vaultAddress(), "addLocked", nil, [AttachedPayment(quoteAsset(), (_amount - rolloverFee))]) | |
1373 | 1298 | else invoke(vaultAddress(), "withdrawLocked", [(rolloverFee - _amount)], nil) | |
1374 | 1299 | if ((stake == stake)) | |
1375 | 1300 | then { | |
1376 | 1301 | let depositVault = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)]) | |
1377 | 1302 | if ((depositVault == depositVault)) | |
1378 | 1303 | then { | |
1379 | 1304 | let notifyFee = invoke(minerAddress(), "notifyFees", [_trader, feeAmount], nil) | |
1380 | 1305 | if ((notifyFee == notifyFee)) | |
1381 | 1306 | then { | |
1382 | 1307 | let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, newPositionOpenNotional], nil) | |
1383 | 1308 | if ((notifyNotional == notifyNotional)) | |
1384 | 1309 | then ((((((updatePosition(_trader, newPositionSize, newPositionRemainMargin, newPositionOpenNotional, newPositionLatestCPF, newPositionTimestamp) ++ incrementPositionSequenceNumber(isNewPosition, _trader)) ++ updatePositionFee(isNewPosition, _trader, adjustedFee)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)) ++ transferFee(feeToStakers)) ++ updateBalance(((cbalance() + _amount) - rolloverFee))) ++ doBurnArtifact(burnArtifact, i)) | |
1385 | 1310 | else throw("Strict value is not equal to itself.") | |
1386 | 1311 | } | |
1387 | 1312 | else throw("Strict value is not equal to itself.") | |
1388 | 1313 | } | |
1389 | 1314 | else throw("Strict value is not equal to itself.") | |
1390 | 1315 | } | |
1391 | 1316 | else throw("Strict value is not equal to itself.") | |
1392 | 1317 | } | |
1393 | 1318 | else throw("Strict value is not equal to itself.") | |
1394 | 1319 | } | |
1395 | 1320 | } | |
1396 | 1321 | else throw("Strict value is not equal to itself.") | |
1397 | 1322 | } | |
1398 | 1323 | else throw("Strict value is not equal to itself.") | |
1399 | 1324 | } | |
1400 | 1325 | ||
1401 | 1326 | ||
1402 | 1327 | ||
1403 | 1328 | @Callable(i) | |
1404 | 1329 | func addMargin () = { | |
1405 | 1330 | let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1406 | 1331 | if ((sync == sync)) | |
1407 | 1332 | then { | |
1408 | 1333 | let ensureCalledOnce = invoke(this, "ensureCalledOnce", nil, nil) | |
1409 | 1334 | if ((ensureCalledOnce == ensureCalledOnce)) | |
1410 | 1335 | then { | |
1411 | 1336 | let _trader = toString(i.caller) | |
1412 | 1337 | let _amount = i.payments[0].amount | |
1413 | 1338 | let _assetId = i.payments[0].assetId | |
1414 | 1339 | let _assetIdStr = toBase58String(value(_assetId)) | |
1415 | 1340 | let isQuoteAsset = (_assetId == quoteAsset()) | |
1416 | 1341 | if (if (if (if (if (if (if (!(isQuoteAsset)) | |
1417 | 1342 | then true | |
1418 | 1343 | else !(requireOpenPosition(toString(i.caller)))) | |
1419 | 1344 | then true | |
1420 | 1345 | else !(isSameAsset(_trader, _assetIdStr))) | |
1421 | 1346 | then true | |
1422 | 1347 | else !(initialized())) | |
1423 | 1348 | then true | |
1424 | 1349 | else paused()) | |
1425 | 1350 | then true | |
1426 | 1351 | else closeOnly()) | |
1427 | 1352 | then true | |
1428 | 1353 | else isMarketClosed()) | |
1429 | 1354 | then throw("Invalid addMargin parameters") | |
1430 | 1355 | else { | |
1431 | - | let $ | |
1432 | - | let oldPositionSize = $ | |
1433 | - | let oldPositionMargin = $ | |
1434 | - | let oldPositionOpenNotional = $ | |
1435 | - | let oldPositionLstUpdCPF = $ | |
1436 | - | let oldPositionTimestamp = $ | |
1356 | + | let $t06451064678 = getPosition(_trader) | |
1357 | + | let oldPositionSize = $t06451064678._1 | |
1358 | + | let oldPositionMargin = $t06451064678._2 | |
1359 | + | let oldPositionOpenNotional = $t06451064678._3 | |
1360 | + | let oldPositionLstUpdCPF = $t06451064678._4 | |
1361 | + | let oldPositionTimestamp = $t06451064678._5 | |
1437 | 1362 | let stake = invoke(vaultAddress(), "addLocked", nil, [AttachedPayment(quoteAsset(), _amount)]) | |
1438 | 1363 | if ((stake == stake)) | |
1439 | 1364 | then { | |
1440 | 1365 | let rolloverFee = calcRolloverFee(oldPositionMargin, oldPositionTimestamp) | |
1441 | 1366 | let doTransferFeeToStakers = if ((rolloverFee > 0)) | |
1442 | 1367 | then { | |
1443 | - | let $ | |
1444 | - | let feeToStakers = $ | |
1445 | - | let feeToVault = $ | |
1368 | + | let $t06496365022 = distributeFee(rolloverFee) | |
1369 | + | let feeToStakers = $t06496365022._1 | |
1370 | + | let feeToVault = $t06496365022._2 | |
1446 | 1371 | let unstake = invoke(vaultAddress(), "withdrawLocked", [feeToStakers], nil) | |
1447 | 1372 | if ((unstake == unstake)) | |
1448 | 1373 | then { | |
1449 | 1374 | let lockBadDebt = invoke(vaultAddress(), "exchangeFreeAndLocked", [-(feeToVault)], nil) | |
1450 | 1375 | if ((lockBadDebt == lockBadDebt)) | |
1451 | 1376 | then transferFee(feeToStakers) | |
1452 | 1377 | else throw("Strict value is not equal to itself.") | |
1453 | 1378 | } | |
1454 | 1379 | else throw("Strict value is not equal to itself.") | |
1455 | 1380 | } | |
1456 | 1381 | else nil | |
1457 | 1382 | if ((doTransferFeeToStakers == doTransferFeeToStakers)) | |
1458 | 1383 | then ((updatePosition(_trader, oldPositionSize, ((oldPositionMargin - rolloverFee) + _amount), oldPositionOpenNotional, oldPositionLstUpdCPF, lastTimestamp()) ++ updateBalance(((cbalance() + _amount) - rolloverFee))) ++ doTransferFeeToStakers) | |
1459 | 1384 | else throw("Strict value is not equal to itself.") | |
1460 | 1385 | } | |
1461 | 1386 | else throw("Strict value is not equal to itself.") | |
1462 | 1387 | } | |
1463 | 1388 | } | |
1464 | 1389 | else throw("Strict value is not equal to itself.") | |
1465 | 1390 | } | |
1466 | 1391 | else throw("Strict value is not equal to itself.") | |
1467 | 1392 | } | |
1468 | 1393 | ||
1469 | 1394 | ||
1470 | 1395 | ||
1471 | 1396 | @Callable(i) | |
1472 | 1397 | func removeMargin (_amount) = { | |
1473 | 1398 | let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1474 | 1399 | if ((sync == sync)) | |
1475 | 1400 | then { | |
1476 | 1401 | let ensureCalledOnce = invoke(this, "ensureCalledOnce", nil, nil) | |
1477 | 1402 | if ((ensureCalledOnce == ensureCalledOnce)) | |
1478 | 1403 | then { | |
1479 | 1404 | let _trader = toString(i.caller) | |
1480 | 1405 | if (if (if (if (if ((0 >= _amount)) | |
1481 | 1406 | then true | |
1482 | 1407 | else !(requireOpenPosition(_trader))) | |
1483 | 1408 | then true | |
1484 | 1409 | else !(initialized())) | |
1485 | 1410 | then true | |
1486 | 1411 | else paused()) | |
1487 | 1412 | then true | |
1488 | 1413 | else isMarketClosed()) | |
1489 | 1414 | then throw("Invalid removeMargin parameters") | |
1490 | 1415 | else { | |
1491 | - | let $ | |
1492 | - | let oldPositionSize = $ | |
1493 | - | let oldPositionMargin = $ | |
1494 | - | let oldPositionOpenNotional = $ | |
1495 | - | let oldPositionLstUpdCPF = $ | |
1496 | - | let oldPositionTimestamp = $ | |
1497 | - | let $ | |
1498 | - | let remainMargin = $ | |
1499 | - | let badDebt = $ | |
1500 | - | let fundingPayment = $ | |
1501 | - | let rolloverFee = $ | |
1416 | + | let $t06639566563 = getPosition(_trader) | |
1417 | + | let oldPositionSize = $t06639566563._1 | |
1418 | + | let oldPositionMargin = $t06639566563._2 | |
1419 | + | let oldPositionOpenNotional = $t06639566563._3 | |
1420 | + | let oldPositionLstUpdCPF = $t06639566563._4 | |
1421 | + | let oldPositionTimestamp = $t06639566563._5 | |
1422 | + | let $t06656966818 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, -(_amount)) | |
1423 | + | let remainMargin = $t06656966818._1 | |
1424 | + | let badDebt = $t06656966818._2 | |
1425 | + | let fundingPayment = $t06656966818._3 | |
1426 | + | let rolloverFee = $t06656966818._4 | |
1502 | 1427 | if ((badDebt != 0)) | |
1503 | 1428 | then throw("Invalid removed margin amount") | |
1504 | 1429 | else { | |
1505 | 1430 | let marginRatio = calcMarginRatio(remainMargin, badDebt, oldPositionOpenNotional) | |
1506 | 1431 | if (!(requireMoreMarginRatio(marginRatio, initMarginRatio(), true))) | |
1507 | 1432 | then throw(((("Too much margin removed: " + toString(marginRatio)) + " < ") + toString(initMarginRatio()))) | |
1508 | 1433 | else { | |
1509 | - | let $ | |
1510 | - | let feeToStakers = $ | |
1511 | - | let feeToVault = $ | |
1434 | + | let $t06720467263 = distributeFee(rolloverFee) | |
1435 | + | let feeToStakers = $t06720467263._1 | |
1436 | + | let feeToVault = $t06720467263._2 | |
1512 | 1437 | let doTransferFeeToStakers = if ((rolloverFee > 0)) | |
1513 | 1438 | then { | |
1514 | 1439 | let lockBadDebt = invoke(vaultAddress(), "exchangeFreeAndLocked", [-(feeToVault)], nil) | |
1515 | 1440 | if ((lockBadDebt == lockBadDebt)) | |
1516 | 1441 | then transferFee(feeToStakers) | |
1517 | 1442 | else throw("Strict value is not equal to itself.") | |
1518 | 1443 | } | |
1519 | 1444 | else nil | |
1520 | 1445 | if ((doTransferFeeToStakers == doTransferFeeToStakers)) | |
1521 | 1446 | then { | |
1522 | 1447 | let unstake = invoke(vaultAddress(), "withdrawLocked", [(_amount + feeToStakers)], nil) | |
1523 | 1448 | if ((unstake == unstake)) | |
1524 | 1449 | then (((updatePosition(_trader, oldPositionSize, remainMargin, oldPositionOpenNotional, latestCumulativePremiumFraction(oldPositionSize), lastTimestamp()) ++ withdraw(i.caller, _amount)) ++ updateBalance(((cbalance() - _amount) - rolloverFee))) ++ doTransferFeeToStakers) | |
1525 | 1450 | else throw("Strict value is not equal to itself.") | |
1526 | 1451 | } | |
1527 | 1452 | else throw("Strict value is not equal to itself.") | |
1528 | 1453 | } | |
1529 | 1454 | } | |
1530 | 1455 | } | |
1531 | 1456 | } | |
1532 | 1457 | else throw("Strict value is not equal to itself.") | |
1533 | 1458 | } | |
1534 | 1459 | else throw("Strict value is not equal to itself.") | |
1535 | 1460 | } | |
1536 | 1461 | ||
1537 | 1462 | ||
1538 | 1463 | ||
1539 | 1464 | @Callable(i) | |
1540 | 1465 | func closePosition (_size,_minQuoteAssetAmount,_addToMargin) = { | |
1541 | 1466 | let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1542 | 1467 | if ((sync == sync)) | |
1543 | 1468 | then { | |
1544 | 1469 | let ensureCalledOnce = invoke(this, "ensureCalledOnce", nil, nil) | |
1545 | 1470 | if ((ensureCalledOnce == ensureCalledOnce)) | |
1546 | 1471 | then { | |
1547 | 1472 | let _trader = getActualCaller(i) | |
1548 | 1473 | let _traderAddress = valueOrErrorMessage(addressFromString(_trader), "Invalid caller") | |
1549 | 1474 | let positionFee = getPositionFee(_trader) | |
1550 | 1475 | if (if (if (if (if (if (!(requireOpenPosition(_trader))) | |
1551 | 1476 | then true | |
1552 | 1477 | else !(initialized())) | |
1553 | 1478 | then true | |
1554 | 1479 | else paused()) | |
1555 | 1480 | then true | |
1556 | 1481 | else (0 >= _size)) | |
1557 | 1482 | then true | |
1558 | 1483 | else (0 > _minQuoteAssetAmount)) | |
1559 | 1484 | then true | |
1560 | 1485 | else isMarketClosed()) | |
1561 | 1486 | then throw("Invalid closePosition parameters") | |
1562 | 1487 | else { | |
1563 | 1488 | let oldPositionTimestamp = getPosition(_trader)._5 | |
1564 | - | let $ | |
1565 | - | let newPositionSize = $ | |
1566 | - | let newPositionMargin = $ | |
1567 | - | let newPositionOpenNotional = $ | |
1568 | - | let newPositionLstUpdCPF = $ | |
1569 | - | let positionBadDebt = $ | |
1570 | - | let realizedPnl = $ | |
1571 | - | let marginToTrader = $ | |
1572 | - | let quoteAssetReserveAfter = $ | |
1573 | - | let baseAssetReserveAfter = $ | |
1574 | - | let totalPositionSizeAfter = $ | |
1575 | - | let openInterestNotionalAfter = $ | |
1576 | - | let totalLongAfter = $ | |
1577 | - | let totalShortAfter = $ | |
1578 | - | let totalLongOpenInterestAfter = $ | |
1579 | - | let totalShortOpenInterestAfter = $ | |
1580 | - | let realizedFee = $ | |
1489 | + | let $t06943870023 = internalClosePosition(_trader, _size, positionFee, _minQuoteAssetAmount, _addToMargin, true, true) | |
1490 | + | let newPositionSize = $t06943870023._1 | |
1491 | + | let newPositionMargin = $t06943870023._2 | |
1492 | + | let newPositionOpenNotional = $t06943870023._3 | |
1493 | + | let newPositionLstUpdCPF = $t06943870023._4 | |
1494 | + | let positionBadDebt = $t06943870023._5 | |
1495 | + | let realizedPnl = $t06943870023._6 | |
1496 | + | let marginToTrader = $t06943870023._7 | |
1497 | + | let quoteAssetReserveAfter = $t06943870023._8 | |
1498 | + | let baseAssetReserveAfter = $t06943870023._9 | |
1499 | + | let totalPositionSizeAfter = $t06943870023._10 | |
1500 | + | let openInterestNotionalAfter = $t06943870023._11 | |
1501 | + | let totalLongAfter = $t06943870023._12 | |
1502 | + | let totalShortAfter = $t06943870023._13 | |
1503 | + | let totalLongOpenInterestAfter = $t06943870023._14 | |
1504 | + | let totalShortOpenInterestAfter = $t06943870023._15 | |
1505 | + | let realizedFee = $t06943870023._16 | |
1581 | 1506 | if ((positionBadDebt > 0)) | |
1582 | 1507 | then throw("Invalid closePosition parameters: bad debt") | |
1583 | 1508 | else if ((oldPositionTimestamp >= lastTimestamp())) | |
1584 | 1509 | then throw("Invalid closePosition parameters: wait at least 1 block before closing the position") | |
1585 | 1510 | else { | |
1586 | 1511 | let isPartialClose = (newPositionSize != 0) | |
1587 | 1512 | let withdrawAmount = (marginToTrader + realizedFee) | |
1588 | 1513 | let ammBalance = (cbalance() - withdrawAmount) | |
1589 | 1514 | let ammNewBalance = if ((0 > ammBalance)) | |
1590 | 1515 | then 0 | |
1591 | 1516 | else ammBalance | |
1592 | 1517 | let unstake = invoke(vaultAddress(), "withdrawLocked", [withdrawAmount], nil) | |
1593 | 1518 | if ((unstake == unstake)) | |
1594 | 1519 | then { | |
1595 | - | let $ | |
1596 | - | let feeToStakers = $ | |
1597 | - | let feeToVault = $ | |
1520 | + | let $t07069570754 = distributeFee(realizedFee) | |
1521 | + | let feeToStakers = $t07069570754._1 | |
1522 | + | let feeToVault = $t07069570754._2 | |
1598 | 1523 | let depositVault = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)]) | |
1599 | 1524 | if ((depositVault == depositVault)) | |
1600 | 1525 | then { | |
1601 | 1526 | let notifyFee = invoke(minerAddress(), "notifyFees", [_trader, realizedFee], nil) | |
1602 | 1527 | if ((notifyFee == notifyFee)) | |
1603 | 1528 | then { | |
1604 | 1529 | let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, newPositionOpenNotional], nil) | |
1605 | 1530 | if ((notifyNotional == notifyNotional)) | |
1606 | 1531 | then (((((if (isPartialClose) | |
1607 | 1532 | then updatePosition(_trader, newPositionSize, newPositionMargin, newPositionOpenNotional, newPositionLstUpdCPF, lastTimestamp()) | |
1608 | 1533 | else deletePosition(_trader)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)) ++ (if ((marginToTrader > 0)) | |
1609 | 1534 | then withdraw(_traderAddress, marginToTrader) | |
1610 | 1535 | else nil)) ++ updateBalance(ammNewBalance)) ++ transferFee(feeToStakers)) | |
1611 | 1536 | else throw("Strict value is not equal to itself.") | |
1612 | 1537 | } | |
1613 | 1538 | else throw("Strict value is not equal to itself.") | |
1614 | 1539 | } | |
1615 | 1540 | else throw("Strict value is not equal to itself.") | |
1616 | 1541 | } | |
1617 | 1542 | else throw("Strict value is not equal to itself.") | |
1618 | 1543 | } | |
1619 | 1544 | } | |
1620 | 1545 | } | |
1621 | 1546 | else throw("Strict value is not equal to itself.") | |
1622 | 1547 | } | |
1623 | 1548 | else throw("Strict value is not equal to itself.") | |
1624 | 1549 | } | |
1625 | 1550 | ||
1626 | 1551 | ||
1627 | 1552 | ||
1628 | 1553 | @Callable(i) | |
1629 | 1554 | func liquidate (_trader) = { | |
1630 | 1555 | let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1631 | 1556 | if ((sync == sync)) | |
1632 | 1557 | then { | |
1633 | 1558 | let spotMarginRatio = getMarginRatioByOption(_trader, PNL_OPTION_SPOT) | |
1634 | 1559 | let liquidationMarginRatio = if (isOverFluctuationLimit()) | |
1635 | 1560 | then { | |
1636 | 1561 | let oracleMarginRatio = getMarginRatioByOption(_trader, PNL_OPTION_ORACLE) | |
1637 | 1562 | vmax(spotMarginRatio, oracleMarginRatio) | |
1638 | 1563 | } | |
1639 | 1564 | else spotMarginRatio | |
1640 | 1565 | if (if (if (if (if (!(requireMoreMarginRatio(liquidationMarginRatio, maintenanceMarginRatio(), false))) | |
1641 | 1566 | then true | |
1642 | 1567 | else !(requireOpenPosition(_trader))) | |
1643 | 1568 | then true | |
1644 | 1569 | else !(initialized())) | |
1645 | 1570 | then true | |
1646 | 1571 | else paused()) | |
1647 | 1572 | then true | |
1648 | 1573 | else isMarketClosed()) | |
1649 | 1574 | then throw("Unable to liquidate") | |
1650 | 1575 | else { | |
1651 | 1576 | let isPartialLiquidation = if (if ((spotMarginRatio > liquidationFeeRatio())) | |
1652 | 1577 | then (partialLiquidationRatio() > 0) | |
1653 | 1578 | else false) | |
1654 | 1579 | then (DECIMAL_UNIT > partialLiquidationRatio()) | |
1655 | 1580 | else false | |
1656 | 1581 | let oldPositionSize = getPosition(_trader)._1 | |
1657 | 1582 | let positionSizeAbs = abs(oldPositionSize) | |
1658 | - | let $ | |
1583 | + | let $t07317573498 = if (isPartialLiquidation) | |
1659 | 1584 | then { | |
1660 | 1585 | let liquidationSize = getPartialLiquidationAmount(_trader, oldPositionSize) | |
1661 | 1586 | let liquidationRatio = divd(abs(liquidationSize), positionSizeAbs) | |
1662 | 1587 | $Tuple2(liquidationRatio, abs(liquidationSize)) | |
1663 | 1588 | } | |
1664 | 1589 | else $Tuple2(0, positionSizeAbs) | |
1665 | - | let liquidationRatio = $ | |
1666 | - | let liquidationSize = $ | |
1667 | - | let $ | |
1590 | + | let liquidationRatio = $t07317573498._1 | |
1591 | + | let liquidationSize = $t07317573498._2 | |
1592 | + | let $t07350474142 = internalClosePosition(_trader, if (isPartialLiquidation) | |
1668 | 1593 | then liquidationSize | |
1669 | 1594 | else positionSizeAbs, liquidationFeeRatio(), 0, true, false, true) | |
1670 | - | let newPositionSize = $ | |
1671 | - | let newPositionMargin = $ | |
1672 | - | let newPositionOpenNotional = $ | |
1673 | - | let newPositionLstUpdCPF = $ | |
1674 | - | let positionBadDebt = $ | |
1675 | - | let realizedPnl = $ | |
1676 | - | let marginToTrader = $ | |
1677 | - | let quoteAssetReserveAfter = $ | |
1678 | - | let baseAssetReserveAfter = $ | |
1679 | - | let totalPositionSizeAfter = $ | |
1680 | - | let openInterestNotionalAfter = $ | |
1681 | - | let totalLongAfter = $ | |
1682 | - | let totalShortAfter = $ | |
1683 | - | let totalLongOpenInterestAfter = $ | |
1684 | - | let totalShortOpenInterestAfter = $ | |
1685 | - | let liquidationPenalty = $ | |
1595 | + | let newPositionSize = $t07350474142._1 | |
1596 | + | let newPositionMargin = $t07350474142._2 | |
1597 | + | let newPositionOpenNotional = $t07350474142._3 | |
1598 | + | let newPositionLstUpdCPF = $t07350474142._4 | |
1599 | + | let positionBadDebt = $t07350474142._5 | |
1600 | + | let realizedPnl = $t07350474142._6 | |
1601 | + | let marginToTrader = $t07350474142._7 | |
1602 | + | let quoteAssetReserveAfter = $t07350474142._8 | |
1603 | + | let baseAssetReserveAfter = $t07350474142._9 | |
1604 | + | let totalPositionSizeAfter = $t07350474142._10 | |
1605 | + | let openInterestNotionalAfter = $t07350474142._11 | |
1606 | + | let totalLongAfter = $t07350474142._12 | |
1607 | + | let totalShortAfter = $t07350474142._13 | |
1608 | + | let totalLongOpenInterestAfter = $t07350474142._14 | |
1609 | + | let totalShortOpenInterestAfter = $t07350474142._15 | |
1610 | + | let liquidationPenalty = $t07350474142._16 | |
1686 | 1611 | let feeToLiquidator = (liquidationPenalty / 2) | |
1687 | 1612 | let feeToVault = (liquidationPenalty - feeToLiquidator) | |
1688 | 1613 | let ammBalance = (cbalance() - liquidationPenalty) | |
1689 | 1614 | let newAmmBalance = if ((0 > ammBalance)) | |
1690 | 1615 | then 0 | |
1691 | 1616 | else ammBalance | |
1692 | 1617 | let lockBadDebt = if ((positionBadDebt > 0)) | |
1693 | 1618 | then { | |
1694 | 1619 | let lockBadDebt = invoke(vaultAddress(), "exchangeFreeAndLocked", [(positionBadDebt + liquidationPenalty)], nil) | |
1695 | 1620 | if ((lockBadDebt == lockBadDebt)) | |
1696 | 1621 | then nil | |
1697 | 1622 | else throw("Strict value is not equal to itself.") | |
1698 | 1623 | } | |
1699 | 1624 | else nil | |
1700 | 1625 | if ((lockBadDebt == lockBadDebt)) | |
1701 | 1626 | then { | |
1702 | 1627 | let unstake = invoke(vaultAddress(), "withdrawLocked", [liquidationPenalty], nil) | |
1703 | 1628 | if ((unstake == unstake)) | |
1704 | 1629 | then { | |
1705 | 1630 | let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)]) | |
1706 | 1631 | if ((depositInsurance == depositInsurance)) | |
1707 | 1632 | then { | |
1708 | 1633 | let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, newPositionOpenNotional], nil) | |
1709 | 1634 | if ((notifyNotional == notifyNotional)) | |
1710 | 1635 | then ((((if (isPartialLiquidation) | |
1711 | 1636 | then updatePosition(_trader, newPositionSize, newPositionMargin, newPositionOpenNotional, newPositionLstUpdCPF, lastTimestamp()) | |
1712 | 1637 | else deletePosition(_trader)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)) ++ withdraw(i.caller, feeToLiquidator)) ++ updateBalance(newAmmBalance)) | |
1713 | 1638 | else throw("Strict value is not equal to itself.") | |
1714 | 1639 | } | |
1715 | 1640 | else throw("Strict value is not equal to itself.") | |
1716 | 1641 | } | |
1717 | 1642 | else throw("Strict value is not equal to itself.") | |
1718 | 1643 | } | |
1719 | 1644 | else throw("Strict value is not equal to itself.") | |
1720 | 1645 | } | |
1721 | 1646 | } | |
1722 | 1647 | else throw("Strict value is not equal to itself.") | |
1723 | 1648 | } | |
1724 | 1649 | ||
1725 | 1650 | ||
1726 | 1651 | ||
1727 | 1652 | @Callable(i) | |
1728 | 1653 | func payFunding () = { | |
1729 | 1654 | let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1730 | 1655 | if ((sync == sync)) | |
1731 | 1656 | then { | |
1732 | 1657 | let fundingBlockTimestamp = nextFundingBlockTimestamp() | |
1733 | 1658 | if (if (if ((fundingBlockTimestamp > lastTimestamp())) | |
1734 | 1659 | then true | |
1735 | 1660 | else !(initialized())) | |
1736 | 1661 | then true | |
1737 | 1662 | else paused()) | |
1738 | 1663 | then throw(((("Invalid funding block timestamp: " + toString(lastTimestamp())) + " < ") + toString(fundingBlockTimestamp))) | |
1739 | 1664 | else { | |
1740 | 1665 | let underlyingPrice = getOraclePrice() | |
1741 | - | let $ | |
1742 | - | let shortPremiumFraction = $ | |
1743 | - | let longPremiumFraction = $ | |
1744 | - | let premiumToVault = $ | |
1666 | + | let $t07625576333 = getFunding() | |
1667 | + | let shortPremiumFraction = $t07625576333._1 | |
1668 | + | let longPremiumFraction = $t07625576333._2 | |
1669 | + | let premiumToVault = $t07625576333._3 | |
1745 | 1670 | let doPayFundingToVault = if ((premiumToVault > 0)) | |
1746 | 1671 | then { | |
1747 | 1672 | let doPayFundingToVault = invoke(vaultAddress(), "exchangeFreeAndLocked", [-(premiumToVault)], nil) | |
1748 | 1673 | if ((doPayFundingToVault == doPayFundingToVault)) | |
1749 | 1674 | then nil | |
1750 | 1675 | else throw("Strict value is not equal to itself.") | |
1751 | 1676 | } | |
1752 | 1677 | else nil | |
1753 | 1678 | if ((doPayFundingToVault == doPayFundingToVault)) | |
1754 | 1679 | then updateFunding((fundingBlockTimestamp + fundingPeriodSeconds()), (latestLongCumulativePremiumFraction() + longPremiumFraction), (latestShortCumulativePremiumFraction() + shortPremiumFraction), divd(longPremiumFraction, underlyingPrice), divd(shortPremiumFraction, underlyingPrice)) | |
1755 | 1680 | else throw("Strict value is not equal to itself.") | |
1756 | 1681 | } | |
1757 | 1682 | } | |
1758 | 1683 | else throw("Strict value is not equal to itself.") | |
1759 | 1684 | } | |
1760 | 1685 | ||
1761 | 1686 | ||
1762 | 1687 | ||
1763 | 1688 | @Callable(i) | |
1764 | 1689 | func syncTerminalPriceToOracle () = { | |
1765 | 1690 | let _qtAstR = qtAstR() | |
1766 | 1691 | let _bsAstR = bsAstR() | |
1767 | - | let $ | |
1768 | - | let newQuoteAssetWeight = $ | |
1769 | - | let newBaseAssetWeight = $ | |
1770 | - | let marginToVault = $ | |
1692 | + | let $t07738477750 = getSyncTerminalPrice(getOraclePrice(), _qtAstR, _bsAstR) | |
1693 | + | let newQuoteAssetWeight = $t07738477750._1 | |
1694 | + | let newBaseAssetWeight = $t07738477750._2 | |
1695 | + | let marginToVault = $t07738477750._3 | |
1771 | 1696 | let marginToVaultAdj = if (if ((0 > marginToVault)) | |
1772 | 1697 | then (abs(marginToVault) > cbalance()) | |
1773 | 1698 | else false) | |
1774 | 1699 | then -(cbalance()) | |
1775 | 1700 | else marginToVault | |
1776 | 1701 | let doExchangePnL = if ((marginToVaultAdj != 0)) | |
1777 | 1702 | then { | |
1778 | 1703 | let doExchangePnL = invoke(vaultAddress(), "exchangeFreeAndLocked", [marginToVaultAdj], nil) | |
1779 | 1704 | if ((doExchangePnL == doExchangePnL)) | |
1780 | 1705 | then nil | |
1781 | 1706 | else throw("Strict value is not equal to itself.") | |
1782 | 1707 | } | |
1783 | 1708 | else nil | |
1784 | 1709 | if ((doExchangePnL == doExchangePnL)) | |
1785 | - | then | |
1710 | + | then (updateBalance((cbalance() + marginToVaultAdj)) ++ updateAmmWeights(newQuoteAssetWeight, newBaseAssetWeight)) | |
1786 | 1711 | else throw("Strict value is not equal to itself.") | |
1787 | 1712 | } | |
1788 | 1713 | ||
1789 | 1714 | ||
1790 | 1715 | ||
1791 | 1716 | @Callable(i) | |
1792 | 1717 | func ensureCalledOnce () = if ((i.caller != this)) | |
1793 | 1718 | then throw("Invalid saveCurrentTxId parameters") | |
1794 | 1719 | else { | |
1795 | 1720 | let lastTx = valueOrElse(getString(this, k_lastTx), "") | |
1796 | 1721 | if ((lastTx != toBase58String(i.transactionId))) | |
1797 | 1722 | then [StringEntry(k_lastTx, lastTx)] | |
1798 | 1723 | else throw("Can not call vAMM methods twice in one tx") | |
1799 | 1724 | } | |
1800 | 1725 | ||
1801 | 1726 | ||
1802 | 1727 | ||
1803 | 1728 | @Callable(i) | |
1804 | 1729 | func view_calcRemainMarginWithFundingPayment (_trader) = { | |
1805 | 1730 | let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1806 | 1731 | if ((sync == sync)) | |
1807 | 1732 | then { | |
1808 | - | let $ | |
1809 | - | let positionSize = $ | |
1810 | - | let positionMargin = $ | |
1811 | - | let pon = $ | |
1812 | - | let positionLstUpdCPF = $ | |
1813 | - | let positionTimestamp = $ | |
1814 | - | let $ | |
1815 | - | let positionNotional = $ | |
1816 | - | let unrealizedPnl = $ | |
1817 | - | let $ | |
1818 | - | let remainMargin = $ | |
1819 | - | let badDebt = $ | |
1820 | - | let fundingPayment = $ | |
1821 | - | let rolloverFee = $ | |
1733 | + | let $t07929979423 = getPosition(_trader) | |
1734 | + | let positionSize = $t07929979423._1 | |
1735 | + | let positionMargin = $t07929979423._2 | |
1736 | + | let pon = $t07929979423._3 | |
1737 | + | let positionLstUpdCPF = $t07929979423._4 | |
1738 | + | let positionTimestamp = $t07929979423._5 | |
1739 | + | let $t07942679527 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT) | |
1740 | + | let positionNotional = $t07942679527._1 | |
1741 | + | let unrealizedPnl = $t07942679527._2 | |
1742 | + | let $t07953079754 = calcRemainMarginWithFundingPaymentAndRolloverFee(positionSize, positionMargin, positionLstUpdCPF, positionTimestamp, unrealizedPnl) | |
1743 | + | let remainMargin = $t07953079754._1 | |
1744 | + | let badDebt = $t07953079754._2 | |
1745 | + | let fundingPayment = $t07953079754._3 | |
1746 | + | let rolloverFee = $t07953079754._4 | |
1822 | 1747 | throw(((((((s(remainMargin) + s(fundingPayment)) + s(getMarginRatio(_trader))) + s(unrealizedPnl)) + s(badDebt)) + s(positionNotional)) + s(rolloverFee))) | |
1823 | 1748 | } | |
1824 | 1749 | else throw("Strict value is not equal to itself.") | |
1825 | 1750 | } | |
1826 | 1751 | ||
1827 | 1752 | ||
1828 | 1753 | ||
1829 | 1754 | @Callable(i) | |
1830 | 1755 | func view_getPegAdjustCost (_price) = { | |
1831 | 1756 | let _qtAstR = qtAstR() | |
1832 | 1757 | let _bsAstR = bsAstR() | |
1833 | 1758 | let result = getSyncTerminalPrice(_price, _qtAstR, _bsAstR) | |
1834 | 1759 | throw(toString(result._3)) | |
1835 | 1760 | } | |
1836 | 1761 | ||
1837 | 1762 | ||
1838 | 1763 | ||
1839 | 1764 | @Callable(i) | |
1840 | 1765 | func view_getTerminalAmmPrice () = { | |
1841 | - | let $ | |
1842 | - | let terminalQuoteAssetReserve = $ | |
1843 | - | let terminalBaseAssetReserve = $ | |
1766 | + | let $t08047780558 = getTerminalAmmState() | |
1767 | + | let terminalQuoteAssetReserve = $t08047780558._1 | |
1768 | + | let terminalBaseAssetReserve = $t08047780558._2 | |
1844 | 1769 | let price = divd(muld(terminalQuoteAssetReserve, qtAstW()), muld(terminalBaseAssetReserve, bsAstW())) | |
1845 | 1770 | throw(toString(price)) | |
1846 | 1771 | } | |
1847 | 1772 | ||
1848 | 1773 | ||
1849 | 1774 | ||
1850 | 1775 | @Callable(i) | |
1851 | 1776 | func view_getFunding () = { | |
1852 | 1777 | let underlyingPrice = getOraclePrice() | |
1853 | - | let $ | |
1854 | - | let shortPremiumFraction = $ | |
1855 | - | let longPremiumFraction = $ | |
1856 | - | let premiumToVault = $ | |
1778 | + | let $t08106781145 = getFunding() | |
1779 | + | let shortPremiumFraction = $t08106781145._1 | |
1780 | + | let longPremiumFraction = $t08106781145._2 | |
1781 | + | let premiumToVault = $t08106781145._3 | |
1857 | 1782 | let longFunding = divd(longPremiumFraction, underlyingPrice) | |
1858 | 1783 | let shortFunding = divd(shortPremiumFraction, underlyingPrice) | |
1859 | - | throw(((((s(longFunding) + s(shortFunding)) + s( | |
1784 | + | throw(((((s(longFunding) + s(shortFunding)) + s(getSpotPrice())) + s(getOraclePrice())) + s(premiumToVault))) | |
1860 | 1785 | } | |
1861 | 1786 | ||
1862 | 1787 | ||
1863 | 1788 | ||
1864 | 1789 | @Callable(i) | |
1865 | 1790 | func computeSpotPrice () = { | |
1866 | 1791 | let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil) | |
1867 | 1792 | if ((sync == sync)) | |
1868 | 1793 | then { | |
1869 | 1794 | let result = getSpotPrice() | |
1870 | 1795 | $Tuple2(nil, result) | |
1871 | 1796 | } | |
1872 | 1797 | else throw("Strict value is not equal to itself.") | |
1873 | 1798 | } | |
1874 | 1799 | ||
1875 | 1800 | ||
1876 | 1801 | ||
1877 | 1802 | @Callable(i) | |
1878 | 1803 | func computeFeeForTraderWithArtifact (_trader,_artifactId) = { | |
1879 | 1804 | let result = getForTraderWithArtifact(_trader, _artifactId) | |
1880 | 1805 | $Tuple2(nil, result) | |
1881 | 1806 | } | |
1882 | 1807 | ||
1883 | 1808 | ||
1884 | 1809 | @Verifier(tx) | |
1885 | 1810 | func verify () = { | |
1886 | 1811 | let coordinatorStr = getString(this, k_coordinatorAddress) | |
1887 | 1812 | if (isDefined(coordinatorStr)) | |
1888 | 1813 | then { | |
1889 | 1814 | let admin = getString(addressFromStringValue(value(coordinatorStr)), k_admin_address) | |
1890 | 1815 | if (isDefined(admin)) | |
1891 | 1816 | then valueOrElse(getBoolean(addressFromStringValue(value(admin)), ((("status_" + toString(this)) + "_") + toBase58String(tx.id))), false) | |
1892 | 1817 | else throw("unable to verify: admin not set in coordinator") | |
1893 | 1818 | } | |
1894 | 1819 | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
1895 | 1820 | } | |
1896 | 1821 |
github/deemru/w8io/026f985 321.41 ms ◑