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