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