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