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