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