tx · 5ZRYXQTdiyFXSxtvpq1MceAw1Eqf2z6Kd6BWHJB7ZHz1

3MuzRcW6fRnqCC76KgKznZP68qsWB1J6shn:  -0.07500000 Waves

2023.03.23 21:43 [2503016] smart account 3MuzRcW6fRnqCC76KgKznZP68qsWB1J6shn > SELF 0.00000000 Waves

{ "type": 13, "id": "5ZRYXQTdiyFXSxtvpq1MceAw1Eqf2z6Kd6BWHJB7ZHz1", "fee": 7500000, "feeAssetId": null, "timestamp": 1679597094707, "version": 2, "chainId": 84, "sender": "3MuzRcW6fRnqCC76KgKznZP68qsWB1J6shn", "senderPublicKey": "EjNbd48ENcnJ4wjBkASdYJHavM8QHrAbFDbJ46ffyUcU", "proofs": [ "EfV4EujsCerMDq5161o1ph4oHwwBb6y3hRoDLzw4guUii9Lp8CgPKrYc5ESmGxooewniC65K8N1NfwQyfR2nnGo" ], "script": "base64:BgKAAQgCEgASABIAEgASAwoBARIDCgEBEhAKDgEBAQEBAQEBAQEBAQEBEhUKEwEBAQEBAQEICAgBAQEBAQEBAQESBgoEAQEBCBIDCgEBEgQKAgEBEgYKBAEBAQQSBAoCCAESABIAEgASAwoBCBIECgIIARIDCgEBEgASABIAEgQKAggIrwEADGtfYmFzZU9yYWNsZQIMa19iYXNlT3JhY2xlAA1rX3F1b3RlT3JhY2xlAg1rX3F1b3RlT3JhY2xlAAlrX2JhbGFuY2UCCWtfYmFsYW5jZQAKa19zZXF1ZW5jZQIKa19zZXF1ZW5jZQAOa19wb3NpdGlvblNpemUCDmtfcG9zaXRpb25TaXplABBrX3Bvc2l0aW9uTWFyZ2luAhBrX3Bvc2l0aW9uTWFyZ2luABZrX3Bvc2l0aW9uT3Blbk5vdGlvbmFsAhZrX3Bvc2l0aW9uT3Blbk5vdGlvbmFsAC5rX3Bvc2l0aW9uTGFzdFVwZGF0ZWRDdW11bGF0aXZlUHJlbWl1bUZyYWN0aW9uAhJrX3Bvc2l0aW9uRnJhY3Rpb24AEmtfcG9zaXRpb25TZXF1ZW5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IGFkbWluIG5vdCBzZXQgaW4gY29vcmRpbmF0b3IJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXlIarCB", "height": 2503016, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 78SWcrSAJ4UJ9c5HLKYZGZu9CB7ShxdWBqDWi8jSjvHq Next: BpiEY6rsMhGhvFnGbbw8BCEqCrA2XNzgrgP5VdCGbZE3 Diff:
OldNewDifferences
1818 let k_positionLastUpdatedCumulativePremiumFraction = "k_positionFraction"
1919
2020 let k_positionSequence = "k_positionSequence"
21-
22-let k_positionAsset = "k_positionAsset"
2321
2422 let k_positionFee = "k_positionFee"
2523
9997
10098 let k_quote_asset = "k_quote_asset"
10199
102-let k_quote_staking = "k_quote_staking"
103-
104100 let k_staking_address = "k_staking_address"
105101
106102 let k_miner_address = "k_miner_address"
108104 let k_orders_address = "k_orders_address"
109105
110106 let k_referral_address = "k_referral_address"
111-
112-let k_exchange_address = "k_exchange_address"
113107
114108 let k_nft_manager_address = "k_nft_manager_address"
115109
123117
124118
125119 func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset))
126-
127-
128-func quoteAssetStaking () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_quote_staking)), "Quote asset staking not set")
129120
130121
131122 func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), "Staking not set")
155146 let DIR_LONG = 1
156147
157148 let DIR_SHORT = 2
158-
159-let TWAP_INTERVAL = 15
160149
161150 let SECONDS = 1000
162151
199188 func vmax (_x,_y) = if ((_x >= _y))
200189 then _x
201190 else _y
202-
203-
204-func listToStr (_list) = if ((size(_list) == 0))
205- then ""
206- else makeString(_list, ",")
207-
208-
209-func strToList (_str) = if ((_str == ""))
210- then nil
211- else split(_str, ",")
212-
213-
214-func pushToQueue (_list,_maxSize,_value) = if ((size(_list) > _maxSize))
215- then (removeByIndex(_list, 0) :+ _value)
216- else (_list :+ _value)
217191
218192
219193 func int (k) = valueOrErrorMessage(getInteger(this, k), ("no value for " + k))
354328 else latestShortCumulativePremiumFraction()
355329
356330
357-func getPosition (_trader) = {
358- let positionSizeOpt = getInteger(this, toCompositeKey(k_positionSize, _trader))
331+func getPosition (_trader,_direction) = {
332+ let positionKey = ((_trader + "_") + toString(_direction))
333+ let positionSizeOpt = getInteger(this, toCompositeKey(k_positionSize, positionKey))
359334 match positionSizeOpt {
360335 case positionSize: Int =>
361- $Tuple5(positionSize, getIntegerValue(this, toCompositeKey(k_positionMargin, _trader)), getIntegerValue(this, toCompositeKey(k_positionOpenNotional, _trader)), getIntegerValue(this, toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _trader)), getIntegerValue(this, toCompositeKey(k_positionLastUpdatedTimestamp, _trader)))
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)))
362337 case _ =>
363338 $Tuple5(0, 0, 0, 0, 0)
364339 }
365340 }
366341
367342
368-func getPositionAsset (_trader) = {
369- let positionAssetOpt = getString(this, toCompositeKey(k_positionAsset, _trader))
370- match positionAssetOpt {
371- case positionAsset: String =>
372- positionAsset
373- case _ =>
374- toBase58String(quoteAsset())
375- }
376- }
343+func getDirection (_positionSize) = if ((0 > _positionSize))
344+ then DIR_SHORT
345+ else DIR_LONG
377346
378347
379348 func getPositionFee (_trader) = {
387356 }
388357
389358
390-func requireOpenPosition (_trader) = if ((getPosition(_trader)._1 == 0))
359+func requireOpenPosition (_trader,_direction) = if ((getPosition(_trader, _direction)._1 == 0))
391360 then throw("No open position")
392361 else true
393362
455424 let amountBaseAssetBought = if (_isAdd)
456425 then amountBaseAssetBoughtAbs
457426 else -(amountBaseAssetBoughtAbs)
458- let $t01635216522 = updateReserve(_isAdd, quoteAssetAmountAdjusted, amountBaseAssetBoughtAbs)
459- let quoteAssetReserveAfter1 = $t01635216522._1
460- let baseAssetReserveAfter1 = $t01635216522._2
461- let totalPositionSizeAfter1 = $t01635216522._3
427+ let $t01550515675 = updateReserve(_isAdd, quoteAssetAmountAdjusted, amountBaseAssetBoughtAbs)
428+ let quoteAssetReserveAfter1 = $t01550515675._1
429+ let baseAssetReserveAfter1 = $t01550515675._2
430+ let totalPositionSizeAfter1 = $t01550515675._3
462431 let priceBefore = divd(muld(_qtAstR, _qtAstW), muld(_bsAstR, _bsAstW))
463432 let marketPrice = divd(_quoteAssetAmount, amountBaseAssetBoughtAbs)
464433 let priceDiff = abs((priceBefore - marketPrice))
486455 else 0
487456 let rolloverFee = calcRolloverFee(_oldPositionMargin, _oldPositionLastUpdatedTimestamp)
488457 let signedMargin = (((_marginDelta - rolloverFee) - fundingPayment) + _oldPositionMargin)
489- let $t01877718904 = if ((0 > signedMargin))
458+ let $t01834218469 = if ((0 > signedMargin))
490459 then $Tuple2(0, abs(signedMargin))
491460 else $Tuple2(abs(signedMargin), 0)
492- let remainMargin = $t01877718904._1
493- let badDebt = $t01877718904._2
461+ let remainMargin = $t01834218469._1
462+ let badDebt = $t01834218469._2
494463 $Tuple4(remainMargin, badDebt, fundingPayment, rolloverFee)
495464 }
496465
508477 let quoteAssetDelta = abs((quoteAssetAfter - _quoteAssetReserve))
509478 let quoteAssetSold = muld(quoteAssetDelta, _quoteAssetWeight)
510479 let maxPriceImpactValue = maxPriceImpact()
511- let $t02016620328 = updateReserve(!(_isAdd), quoteAssetDelta, _baseAssetAmount)
512- let quoteAssetReserveAfter1 = $t02016620328._1
513- let baseAssetReserveAfter1 = $t02016620328._2
514- let totalPositionSizeAfter1 = $t02016620328._3
480+ let $t01973119893 = updateReserve(!(_isAdd), quoteAssetDelta, _baseAssetAmount)
481+ let quoteAssetReserveAfter1 = $t01973119893._1
482+ let baseAssetReserveAfter1 = $t01973119893._2
483+ let totalPositionSizeAfter1 = $t01973119893._3
515484 let marketPrice = divd(quoteAssetSold, _baseAssetAmount)
516485 let priceDiff = abs((priceBefore - marketPrice))
517486 let priceImpact = (DECIMAL_UNIT - divd(priceBefore, (priceBefore + priceDiff)))
645614 }
646615
647616
648-func getPositionNotionalAndUnrealizedPnl (_trader,_option) = {
649- let $t02820628334 = getPosition(_trader)
650- let positionSize = $t02820628334._1
651- let positionMargin = $t02820628334._2
652- let positionOpenNotional = $t02820628334._3
653- let positionLstUpdCPF = $t02820628334._4
617+func getPositionNotionalAndUnrealizedPnl (_trader,_direction,_option) = {
618+ let $t02778827928 = getPosition(_trader, _direction)
619+ let positionSize = $t02778827928._1
620+ let positionMargin = $t02778827928._2
621+ let positionOpenNotional = $t02778827928._3
622+ let positionLstUpdCPF = $t02778827928._4
654623 getPositionNotionalAndUnrealizedPnlByValues(positionSize, positionOpenNotional, qtAstR(), qtAstW(), bsAstR(), bsAstW(), _option)
655624 }
656625
658627 func calcMarginRatio (_remainMargin,_badDebt,_positionNotional) = divd((_remainMargin - _badDebt), _positionNotional)
659628
660629
661-func getMarginRatioByOption (_trader,_option) = {
662- let $t02884928990 = getPosition(_trader)
663- let positionSize = $t02884928990._1
664- let positionMargin = $t02884928990._2
665- let pon = $t02884928990._3
666- let positionLastUpdatedCPF = $t02884928990._4
667- let positionTimestamp = $t02884928990._5
668- let $t02899629089 = getPositionNotionalAndUnrealizedPnl(_trader, _option)
669- let positionNotional = $t02899629089._1
670- let unrealizedPnl = $t02899629089._2
671- let $t02909429306 = calcRemainMarginWithFundingPaymentAndRolloverFee(positionSize, positionMargin, positionLastUpdatedCPF, positionTimestamp, unrealizedPnl)
672- let remainMargin = $t02909429306._1
673- let badDebt = $t02909429306._2
630+func getMarginRatioByOption (_trader,_direction,_option) = {
631+ let $t02846028613 = getPosition(_trader, _direction)
632+ let positionSize = $t02846028613._1
633+ let positionMargin = $t02846028613._2
634+ let pon = $t02846028613._3
635+ let positionLastUpdatedCPF = $t02846028613._4
636+ let positionTimestamp = $t02846028613._5
637+ let $t02861928724 = getPositionNotionalAndUnrealizedPnl(_trader, _direction, _option)
638+ let positionNotional = $t02861928724._1
639+ let unrealizedPnl = $t02861928724._2
640+ let $t02872928941 = calcRemainMarginWithFundingPaymentAndRolloverFee(positionSize, positionMargin, positionLastUpdatedCPF, positionTimestamp, unrealizedPnl)
641+ let remainMargin = $t02872928941._1
642+ let badDebt = $t02872928941._2
674643 calcMarginRatio(remainMargin, badDebt, positionNotional)
675644 }
676645
677646
678-func getMarginRatio (_trader) = getMarginRatioByOption(_trader, PNL_OPTION_SPOT)
647+func getMarginRatio (_trader,_direction) = getMarginRatioByOption(_trader, _direction, PNL_OPTION_SPOT)
679648
680649
681650 func getPartialLiquidationAmount (_trader,_positionSize) = {
682- let maximumRatio = vmax(partialLiquidationRatio(), (DECIMAL_UNIT - divd(getMarginRatio(_trader), maintenanceMarginRatio())))
651+ let maximumRatio = vmax(partialLiquidationRatio(), (DECIMAL_UNIT - divd(getMarginRatio(_trader, getDirection(_positionSize)), maintenanceMarginRatio())))
683652 let maxExchangedPositionSize = muld(abs(_positionSize), maximumRatio)
684653 let swapResult = swapOutput((_positionSize > 0), maxExchangedPositionSize, false)
685654 let maxExchangedQuoteAssetAmount = swapResult._1
690659 }
691660
692661
693-func internalClosePosition (_trader,_size,_fee,_minQuoteAssetAmount,_addToMargin,_checkMaxPriceImpact,_liquidate) = {
694- let $t03037330529 = getPosition(_trader)
695- let oldPositionSize = $t03037330529._1
696- let oldPositionMargin = $t03037330529._2
697- let oldPositionOpenNotional = $t03037330529._3
698- let oldPositionLstUpdCPF = $t03037330529._4
699- let oldPositionTimestamp = $t03037330529._5
662+func internalClosePosition (_trader,_direction,_size,_fee,_minQuoteAssetAmount,_addToMargin,_checkMaxPriceImpact,_liquidate) = {
663+ let $t03010430272 = getPosition(_trader, _direction)
664+ let oldPositionSize = $t03010430272._1
665+ let oldPositionMargin = $t03010430272._2
666+ let oldPositionOpenNotional = $t03010430272._3
667+ let oldPositionLstUpdCPF = $t03010430272._4
668+ let oldPositionTimestamp = $t03010430272._5
700669 let isLongPosition = (oldPositionSize > 0)
701670 let absOldPositionSize = abs(oldPositionSize)
702671 if (if ((absOldPositionSize >= _size))
704673 else false)
705674 then {
706675 let isPartialClose = (absOldPositionSize > _size)
707- let $t03082131272 = swapOutput((oldPositionSize > 0), _size, _checkMaxPriceImpact)
708- let exchangedQuoteAssetAmount = $t03082131272._1
709- let quoteAssetReserveAfter = $t03082131272._2
710- let baseAssetReserveAfter = $t03082131272._3
711- let totalPositionSizeAfter = $t03082131272._4
676+ let $t03056431015 = swapOutput((oldPositionSize > 0), _size, _checkMaxPriceImpact)
677+ let exchangedQuoteAssetAmount = $t03056431015._1
678+ let quoteAssetReserveAfter = $t03056431015._2
679+ let baseAssetReserveAfter = $t03056431015._3
680+ let totalPositionSizeAfter = $t03056431015._4
712681 let exchangedPositionSize = if ((oldPositionSize > 0))
713682 then -(_size)
714683 else _size
715- let $t03148731694 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
716- let oldPositionNotional = $t03148731694._1
717- let unrealizedPnl = $t03148731694._2
684+ let $t03123031454 = getPositionNotionalAndUnrealizedPnl(_trader, _direction, PNL_OPTION_SPOT)
685+ let oldPositionNotional = $t03123031454._1
686+ let unrealizedPnl = $t03123031454._2
718687 let realizedRatio = divd(abs(exchangedPositionSize), absOldPositionSize)
719688 let realizedPnl = muld(unrealizedPnl, realizedRatio)
720- let $t03203532281 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, unrealizedPnl)
721- let remainMarginBefore = $t03203532281._1
722- let x1 = $t03203532281._2
723- let x2 = $t03203532281._3
724- let rolloverFee = $t03203532281._4
689+ let $t03179532041 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, unrealizedPnl)
690+ let remainMarginBefore = $t03179532041._1
691+ let x1 = $t03179532041._2
692+ let x2 = $t03179532041._3
693+ let rolloverFee = $t03179532041._4
725694 let positionBadDebt = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, realizedPnl)._2
726695 let realizedCloseFee = muld(muld(oldPositionNotional, realizedRatio), _fee)
727696 let unrealizedPnlAfter = (unrealizedPnl - realizedPnl)
729698 then ((oldPositionNotional - exchangedQuoteAssetAmount) - unrealizedPnlAfter)
730699 else ((unrealizedPnlAfter + oldPositionNotional) - exchangedQuoteAssetAmount)
731700 let newPositionSize = (oldPositionSize + exchangedPositionSize)
732- let $t03368734073 = if ((newPositionSize == 0))
701+ let $t03344733833 = if ((newPositionSize == 0))
733702 then $Tuple2(0, 0)
734703 else $Tuple2(abs(remainOpenNotional), latestCumulativePremiumFraction(newPositionSize))
735- let newPositionOpenNotional = $t03368734073._1
736- let newPositionLstUpdCPF = $t03368734073._2
704+ let newPositionOpenNotional = $t03344733833._1
705+ let newPositionLstUpdCPF = $t03344733833._2
737706 let openNotionalDelta = (oldPositionOpenNotional - newPositionOpenNotional)
738- let marginRatio = getMarginRatioByOption(_trader, PNL_OPTION_SPOT)
707+ let marginRatio = getMarginRatioByOption(_trader, _direction, PNL_OPTION_SPOT)
739708 let newPositionMarginWithSameRatio = if ((oldPositionSize > 0))
740709 then (muld((newPositionOpenNotional + unrealizedPnlAfter), marginRatio) - unrealizedPnlAfter)
741710 else (muld((newPositionOpenNotional - unrealizedPnlAfter), marginRatio) - unrealizedPnlAfter)
776745 then $Tuple2(qtAstR(), bsAstR())
777746 else {
778747 let direction = (_positionSize > 0)
779- let $t03730837487 = swapOutput(direction, abs(_positionSize), false)
780- let currentNetMarketValue = $t03730837487._1
781- let terminalQuoteAssetReserve = $t03730837487._2
782- let terminalBaseAssetReserve = $t03730837487._3
748+ let $t03708037259 = swapOutput(direction, abs(_positionSize), false)
749+ let currentNetMarketValue = $t03708037259._1
750+ let terminalQuoteAssetReserve = $t03708037259._2
751+ let terminalBaseAssetReserve = $t03708037259._3
783752 $Tuple2(terminalQuoteAssetReserve, terminalBaseAssetReserve)
784753 }
785754 }
819788
820789 func getFunding () = {
821790 let underlyingPrice = getOraclePrice()
822- let spotTwapPrice = getSpotPrice()
823- let premium = (spotTwapPrice - underlyingPrice)
791+ let spotPrice = getSpotPrice()
792+ let premium = (spotPrice - underlyingPrice)
824793 if (if (if ((totalShortPositionSize() == 0))
825794 then true
826795 else (totalLongPositionSize() == 0))
862831 func getAdjustedFee (_artifactId,_baseFeeDiscount) = {
863832 let baseFeeRaw = fee()
864833 let baseFee = muld(baseFeeRaw, _baseFeeDiscount)
865- let $t04122941724 = if ((_artifactId != ""))
834+ let $t04183442329 = if ((_artifactId != ""))
866835 then {
867836 let artifactKind = strA(nftManagerAddress(), toCompositeKey(k_token_type, _artifactId))
868837 if ((artifactKind == FEE_REDUCTION_TOKEN_TYPE))
874843 else throw("Invalid attached artifact")
875844 }
876845 else $Tuple2(baseFee, false)
877- let adjustedFee = $t04122941724._1
878- let burnArtifact = $t04122941724._2
846+ let adjustedFee = $t04183442329._1
847+ let burnArtifact = $t04183442329._2
879848 $Tuple2(adjustedFee, burnArtifact)
880849 }
881-
882-
883-func isSameAssetOrNoPosition (_trader,_assetId) = {
884- let oldPositionSize = getPosition(_trader)._1
885- if ((oldPositionSize == 0))
886- then true
887- else (getPositionAsset(_trader) == _assetId)
888- }
889-
890-
891-func isSameAsset (_trader,_assetId) = (getPositionAsset(_trader) == _assetId)
892850
893851
894852 func getForTraderWithArtifact (_trader,_artifactId) = {
901859 case _ =>
902860 throw("Invalid computeFeeDiscount result")
903861 }
904- let $t04240442478 = getAdjustedFee(_artifactId, feeDiscount)
905- let adjustedFee = $t04240442478._1
906- let burnArtifact = $t04240442478._2
862+ let $t04267542749 = getAdjustedFee(_artifactId, feeDiscount)
863+ let adjustedFee = $t04267542749._1
864+ let burnArtifact = $t04267542749._2
907865 $Tuple2(adjustedFee, burnArtifact)
908866 }
909867 else throw("Strict value is not equal to itself.")
931889 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)]
932890
933891
934-func incrementPositionSequenceNumber (_isNewPosition,_address) = if (_isNewPosition)
935- then {
936- let currentSequence = lastSequence()
937-[IntegerEntry(toCompositeKey(k_positionSequence, _address), (currentSequence + 1)), IntegerEntry(k_sequence, (currentSequence + 1))]
938- }
939- else nil
892+func incrementPositionSequenceNumber (_isNewPosition,_trader,_direction) = {
893+ let positionKey = ((_trader + "_") + toString(_direction))
894+ if (_isNewPosition)
895+ then {
896+ let currentSequence = lastSequence()
897+[IntegerEntry(toCompositeKey(k_positionSequence, positionKey), (currentSequence + 1)), IntegerEntry(k_sequence, (currentSequence + 1))]
898+ }
899+ else nil
900+ }
940901
941902
942-func updatePositionFee (_isNewPosition,_address,_fee) = if (_isNewPosition)
943- then [IntegerEntry(toCompositeKey(k_positionFee, _address), _fee)]
944- else nil
903+func updatePositionFee (_isNewPosition,_trader,_direction,_fee) = {
904+ let positionKey = ((_trader + "_") + toString(_direction))
905+ if (_isNewPosition)
906+ then [IntegerEntry(toCompositeKey(k_positionFee, positionKey), _fee)]
907+ else nil
908+ }
945909
946910
947-func updatePosition (_address,_size,_margin,_openNotional,_latestCumulativePremiumFraction,_latestTimestamp) = [IntegerEntry(toCompositeKey(k_positionSize, _address), _size), IntegerEntry(toCompositeKey(k_positionMargin, _address), _margin), IntegerEntry(toCompositeKey(k_positionOpenNotional, _address), _openNotional), IntegerEntry(toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _address), _latestCumulativePremiumFraction), IntegerEntry(toCompositeKey(k_positionLastUpdatedTimestamp, _address), _latestTimestamp)]
911+func updatePosition (_trader,_size,_margin,_openNotional,_latestCumulativePremiumFraction,_latestTimestamp) = {
912+ let direction = getDirection(_size)
913+ let positionKey = ((_trader + "_") + toString(direction))
914+[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+ }
948916
949917
950918 func updateAmmReserves (_qtAstR,_bsAstR) = [IntegerEntry(k_quoteAssetReserve, _qtAstR), IntegerEntry(k_baseAssetReserve, _bsAstR)]
962930 }
963931
964932
965-func deletePosition (_address) = [DeleteEntry(toCompositeKey(k_positionSize, _address)), DeleteEntry(toCompositeKey(k_positionMargin, _address)), DeleteEntry(toCompositeKey(k_positionOpenNotional, _address)), DeleteEntry(toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _address)), DeleteEntry(toCompositeKey(k_positionAsset, _address)), DeleteEntry(toCompositeKey(k_positionFee, _address)), DeleteEntry(toCompositeKey(k_positionLastUpdatedTimestamp, _address))]
933+func deletePosition (_trader,_direction) = {
934+ let positionKey = ((_trader + "_") + toString(_direction))
935+[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+ }
966937
967938
968939 func withdraw (_address,_amount) = {
1028999 let qtAstRAfter = (_qtAstR + _quoteAssetAmount)
10291000 let baseAssetAmountToAdd = (divd(muld(qtAstRAfter, _qtAstW), price) - _bsAstR)
10301001 let bsAstRAfter = (_bsAstR + baseAssetAmountToAdd)
1031- let $t05043150582 = getSyncTerminalPrice(getOraclePrice(), qtAstRAfter, bsAstRAfter)
1032- let newQuoteAssetWeight = $t05043150582._1
1033- let newBaseAssetWeight = $t05043150582._2
1034- let marginToVault = $t05043150582._3
1002+ let $t05100451155 = getSyncTerminalPrice(getOraclePrice(), qtAstRAfter, bsAstRAfter)
1003+ let newQuoteAssetWeight = $t05100451155._1
1004+ let newBaseAssetWeight = $t05100451155._2
1005+ let marginToVault = $t05100451155._3
10351006 let doExchangePnL = if ((marginToVault != 0))
10361007 then {
10371008 let doExchangePnL = invoke(vaultAddress(), "exchangeFreeAndLocked", [marginToVault], nil)
10611032 let qtAstRAfter = (_qtAstR - _quoteAssetAmount)
10621033 let baseAssetAmountToRemove = abs((divd(muld(qtAstRAfter, _qtAstW), price) - _bsAstR))
10631034 let bsAstRAfter = (_bsAstR - baseAssetAmountToRemove)
1064- let $t05167851829 = getSyncTerminalPrice(getOraclePrice(), qtAstRAfter, bsAstRAfter)
1065- let newQuoteAssetWeight = $t05167851829._1
1066- let newBaseAssetWeight = $t05167851829._2
1067- let marginToVault = $t05167851829._3
1035+ let $t05225152402 = getSyncTerminalPrice(getOraclePrice(), qtAstRAfter, bsAstRAfter)
1036+ let newQuoteAssetWeight = $t05225152402._1
1037+ let newBaseAssetWeight = $t05225152402._2
1038+ let marginToVault = $t05225152402._3
10681039 let doExchangePnL = if ((marginToVault != 0))
10691040 then {
10701041 let doExchangePnL = invoke(vaultAddress(), "exchangeFreeAndLocked", [marginToVault], nil)
11791150 let _assetId = i.payments[0].assetId
11801151 let _assetIdStr = toBase58String(value(_assetId))
11811152 let isQuoteAsset = (_assetId == quoteAsset())
1182- if (if (if (if (if (if (if (if (if (if ((_direction != DIR_LONG))
1153+ if (if (if (if (if (if (if (if (if ((_direction != DIR_LONG))
11831154 then (_direction != DIR_SHORT)
11841155 else false)
11851156 then true
11881159 else !(initialized()))
11891160 then true
11901161 else !(isQuoteAsset))
1191- then true
1192- else !(isSameAssetOrNoPosition(_trader, _assetIdStr)))
11931162 then true
11941163 else !(requireMoreMarginRatio(divd(DECIMAL_UNIT, _leverage), initMarginRatio(), true)))
11951164 then true
12001169 else isMarketClosed())
12011170 then throw("Invalid increasePosition parameters")
12021171 else {
1203- let $t05795358102 = getForTraderWithArtifact(_trader, getArtifactId(i))
1204- let adjustedFee = $t05795358102._1
1205- let burnArtifact = $t05795358102._2
1172+ let $t05847258621 = getForTraderWithArtifact(_trader, getArtifactId(i))
1173+ let adjustedFee = $t05847258621._1
1174+ let burnArtifact = $t05847258621._2
12061175 let _amount = divd(_rawAmount, (muld(adjustedFee, _leverage) + DECIMAL_UNIT))
12071176 let distributeFeeAmount = (_rawAmount - _amount)
12081177 let referrerFeeAny = invoke(referralAddress(), "acceptPaymentWithLink", [_trader, _refLink], [AttachedPayment(quoteAsset(), distributeFeeAmount)])
12151184 throw("Invalid referrerFee")
12161185 }
12171186 let feeAmount = (distributeFeeAmount - referrerFee)
1218- let $t05859858766 = getPosition(_trader)
1219- let oldPositionSize = $t05859858766._1
1220- let oldPositionMargin = $t05859858766._2
1221- let oldPositionOpenNotional = $t05859858766._3
1222- let oldPositionLstUpdCPF = $t05859858766._4
1223- let oldPositionTimestamp = $t05859858766._5
1187+ let $t05911759297 = getPosition(_trader, _direction)
1188+ let oldPositionSize = $t05911759297._1
1189+ let oldPositionMargin = $t05911759297._2
1190+ let oldPositionOpenNotional = $t05911759297._3
1191+ let oldPositionLstUpdCPF = $t05911759297._4
1192+ let oldPositionTimestamp = $t05911759297._5
12241193 let isNewPosition = (oldPositionSize == 0)
12251194 let isSameDirection = if ((oldPositionSize > 0))
12261195 then (_direction == DIR_LONG)
12291198 then isSameDirection
12301199 else false
12311200 let isAdd = (_direction == DIR_LONG)
1232- let $t05905562176 = if (if (isNewPosition)
1201+ let $t05958662719 = if (if (isNewPosition)
12331202 then true
12341203 else expandExisting)
12351204 then {
12361205 let openNotional = muld(_amount, _leverage)
1237- let $t05956459737 = swapInput(isAdd, openNotional)
1238- let amountBaseAssetBought = $t05956459737._1
1239- let quoteAssetReserveAfter = $t05956459737._2
1240- let baseAssetReserveAfter = $t05956459737._3
1241- let totalPositionSizeAfter = $t05956459737._4
1206+ let $t06009560268 = swapInput(isAdd, openNotional)
1207+ let amountBaseAssetBought = $t06009560268._1
1208+ let quoteAssetReserveAfter = $t06009560268._2
1209+ let baseAssetReserveAfter = $t06009560268._3
1210+ let totalPositionSizeAfter = $t06009560268._4
12421211 if (if ((_minBaseAssetAmount != 0))
12431212 then (_minBaseAssetAmount > abs(amountBaseAssetBought))
12441213 else false)
12511220 let totalShortOpenInterestAfter = (openInterestShort() + (if ((0 > newPositionSize))
12521221 then openNotional
12531222 else 0))
1254- let $t06028360558 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, _amount)
1255- let remainMargin = $t06028360558._1
1256- let x1 = $t06028360558._2
1257- let x2 = $t06028360558._3
1258- let rolloverFee = $t06028360558._4
1223+ let $t06081461089 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, _amount)
1224+ let remainMargin = $t06081461089._1
1225+ let x1 = $t06081461089._2
1226+ let x2 = $t06081461089._3
1227+ let rolloverFee = $t06081461089._4
12591228 if (!(requireNotOverSpreadLimit(quoteAssetReserveAfter, baseAssetReserveAfter)))
12601229 then throw("Over max spread limit")
12611230 else if (!(requireNotOverMaxOpenNotional(totalLongOpenInterestAfter, totalShortOpenInterestAfter)))
12691238 }
12701239 else {
12711240 let openNotional = muld(_amount, _leverage)
1272- let $t06187661992 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT)
1273- let oldPositionNotional = $t06187661992._1
1274- let unrealizedPnl = $t06187661992._2
1241+ let $t06240762535 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), _direction, PNL_OPTION_SPOT)
1242+ let oldPositionNotional = $t06240762535._1
1243+ let unrealizedPnl = $t06240762535._2
12751244 if ((oldPositionNotional > openNotional))
12761245 then throw("Use decreasePosition to decrease position size")
12771246 else throw("Close position first")
12781247 }
1279- let newPositionSize = $t05905562176._1
1280- let newPositionRemainMargin = $t05905562176._2
1281- let newPositionOpenNotional = $t05905562176._3
1282- let newPositionLatestCPF = $t05905562176._4
1283- let newPositionTimestamp = $t05905562176._5
1284- let baseAssetReserveAfter = $t05905562176._6
1285- let quoteAssetReserveAfter = $t05905562176._7
1286- let totalPositionSizeAfter = $t05905562176._8
1287- let openInterestNotionalAfter = $t05905562176._9
1288- let totalLongAfter = $t05905562176._10
1289- let totalShortAfter = $t05905562176._11
1290- let totalLongOpenInterestAfter = $t05905562176._12
1291- let totalShortOpenInterestAfter = $t05905562176._13
1292- let rolloverFee = $t05905562176._14
1293- let $t06218262253 = distributeFee((feeAmount + rolloverFee))
1294- let feeToStakers = $t06218262253._1
1295- let feeToVault = $t06218262253._2
1248+ let newPositionSize = $t05958662719._1
1249+ let newPositionRemainMargin = $t05958662719._2
1250+ let newPositionOpenNotional = $t05958662719._3
1251+ let newPositionLatestCPF = $t05958662719._4
1252+ let newPositionTimestamp = $t05958662719._5
1253+ let baseAssetReserveAfter = $t05958662719._6
1254+ let quoteAssetReserveAfter = $t05958662719._7
1255+ let totalPositionSizeAfter = $t05958662719._8
1256+ let openInterestNotionalAfter = $t05958662719._9
1257+ let totalLongAfter = $t05958662719._10
1258+ let totalShortAfter = $t05958662719._11
1259+ let totalLongOpenInterestAfter = $t05958662719._12
1260+ let totalShortOpenInterestAfter = $t05958662719._13
1261+ let rolloverFee = $t05958662719._14
1262+ let $t06272562796 = distributeFee((feeAmount + rolloverFee))
1263+ let feeToStakers = $t06272562796._1
1264+ let feeToVault = $t06272562796._2
12961265 let stake = if ((_amount >= rolloverFee))
12971266 then invoke(vaultAddress(), "addLocked", nil, [AttachedPayment(quoteAsset(), (_amount - rolloverFee))])
12981267 else invoke(vaultAddress(), "withdrawLocked", [(rolloverFee - _amount)], nil)
13061275 then {
13071276 let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, newPositionOpenNotional], nil)
13081277 if ((notifyNotional == notifyNotional))
1309- then ((((((updatePosition(_trader, newPositionSize, newPositionRemainMargin, newPositionOpenNotional, newPositionLatestCPF, newPositionTimestamp) ++ incrementPositionSequenceNumber(isNewPosition, _trader)) ++ updatePositionFee(isNewPosition, _trader, adjustedFee)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)) ++ transferFee(feeToStakers)) ++ updateBalance(((cbalance() + _amount) - rolloverFee))) ++ doBurnArtifact(burnArtifact, i))
1278+ 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))
13101279 else throw("Strict value is not equal to itself.")
13111280 }
13121281 else throw("Strict value is not equal to itself.")
13261295
13271296
13281297 @Callable(i)
1329-func addMargin () = {
1298+func addMargin (_direction) = {
13301299 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
13311300 if ((sync == sync))
13321301 then {
13381307 let _assetId = i.payments[0].assetId
13391308 let _assetIdStr = toBase58String(value(_assetId))
13401309 let isQuoteAsset = (_assetId == quoteAsset())
1341- if (if (if (if (if (if (if (!(isQuoteAsset))
1310+ if (if (if (if (if (!(isQuoteAsset))
13421311 then true
1343- else !(requireOpenPosition(toString(i.caller))))
1344- then true
1345- else !(isSameAsset(_trader, _assetIdStr)))
1312+ else !(requireOpenPosition(toString(i.caller), _direction)))
13461313 then true
13471314 else !(initialized()))
13481315 then true
13491316 else paused())
13501317 then true
1351- else closeOnly())
1352- then true
13531318 else isMarketClosed())
13541319 then throw("Invalid addMargin parameters")
13551320 else {
1356- let $t06451064678 = getPosition(_trader)
1357- let oldPositionSize = $t06451064678._1
1358- let oldPositionMargin = $t06451064678._2
1359- let oldPositionOpenNotional = $t06451064678._3
1360- let oldPositionLstUpdCPF = $t06451064678._4
1361- let oldPositionTimestamp = $t06451064678._5
1321+ let $t06504365223 = getPosition(_trader, _direction)
1322+ let oldPositionSize = $t06504365223._1
1323+ let oldPositionMargin = $t06504365223._2
1324+ let oldPositionOpenNotional = $t06504365223._3
1325+ let oldPositionLstUpdCPF = $t06504365223._4
1326+ let oldPositionTimestamp = $t06504365223._5
13621327 let stake = invoke(vaultAddress(), "addLocked", nil, [AttachedPayment(quoteAsset(), _amount)])
13631328 if ((stake == stake))
13641329 then {
13651330 let rolloverFee = calcRolloverFee(oldPositionMargin, oldPositionTimestamp)
13661331 let doTransferFeeToStakers = if ((rolloverFee > 0))
13671332 then {
1368- let $t06496365022 = distributeFee(rolloverFee)
1369- let feeToStakers = $t06496365022._1
1370- let feeToVault = $t06496365022._2
1333+ let $t06550865567 = distributeFee(rolloverFee)
1334+ let feeToStakers = $t06550865567._1
1335+ let feeToVault = $t06550865567._2
13711336 let unstake = invoke(vaultAddress(), "withdrawLocked", [feeToStakers], nil)
13721337 if ((unstake == unstake))
13731338 then {
13941359
13951360
13961361 @Callable(i)
1397-func removeMargin (_amount) = {
1362+func removeMargin (_amount,_direction) = {
13981363 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
13991364 if ((sync == sync))
14001365 then {
14041369 let _trader = toString(i.caller)
14051370 if (if (if (if (if ((0 >= _amount))
14061371 then true
1407- else !(requireOpenPosition(_trader)))
1372+ else !(requireOpenPosition(_trader, _direction)))
14081373 then true
14091374 else !(initialized()))
14101375 then true
14131378 else isMarketClosed())
14141379 then throw("Invalid removeMargin parameters")
14151380 else {
1416- let $t06639566563 = getPosition(_trader)
1417- let oldPositionSize = $t06639566563._1
1418- let oldPositionMargin = $t06639566563._2
1419- let oldPositionOpenNotional = $t06639566563._3
1420- let oldPositionLstUpdCPF = $t06639566563._4
1421- let oldPositionTimestamp = $t06639566563._5
1422- let $t06656966818 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, -(_amount))
1423- let remainMargin = $t06656966818._1
1424- let badDebt = $t06656966818._2
1425- let fundingPayment = $t06656966818._3
1426- let rolloverFee = $t06656966818._4
1381+ let $t06697167151 = getPosition(_trader, _direction)
1382+ let oldPositionSize = $t06697167151._1
1383+ let oldPositionMargin = $t06697167151._2
1384+ let oldPositionOpenNotional = $t06697167151._3
1385+ let oldPositionLstUpdCPF = $t06697167151._4
1386+ let oldPositionTimestamp = $t06697167151._5
1387+ let $t06715767406 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, -(_amount))
1388+ let remainMargin = $t06715767406._1
1389+ let badDebt = $t06715767406._2
1390+ let fundingPayment = $t06715767406._3
1391+ let rolloverFee = $t06715767406._4
14271392 if ((badDebt != 0))
14281393 then throw("Invalid removed margin amount")
14291394 else {
14311396 if (!(requireMoreMarginRatio(marginRatio, initMarginRatio(), true)))
14321397 then throw(((("Too much margin removed: " + toString(marginRatio)) + " < ") + toString(initMarginRatio())))
14331398 else {
1434- let $t06720467263 = distributeFee(rolloverFee)
1435- let feeToStakers = $t06720467263._1
1436- let feeToVault = $t06720467263._2
1399+ let $t06779267851 = distributeFee(rolloverFee)
1400+ let feeToStakers = $t06779267851._1
1401+ let feeToVault = $t06779267851._2
14371402 let doTransferFeeToStakers = if ((rolloverFee > 0))
14381403 then {
14391404 let lockBadDebt = invoke(vaultAddress(), "exchangeFreeAndLocked", [-(feeToVault)], nil)
14621427
14631428
14641429 @Callable(i)
1465-func closePosition (_size,_minQuoteAssetAmount,_addToMargin) = {
1430+func closePosition (_size,_direction,_minQuoteAssetAmount,_addToMargin) = {
14661431 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
14671432 if ((sync == sync))
14681433 then {
14721437 let _trader = getActualCaller(i)
14731438 let _traderAddress = valueOrErrorMessage(addressFromString(_trader), "Invalid caller")
14741439 let positionFee = getPositionFee(_trader)
1475- if (if (if (if (if (if (!(requireOpenPosition(_trader)))
1440+ if (if (if (if (if (if (!(requireOpenPosition(_trader, _direction)))
14761441 then true
14771442 else !(initialized()))
14781443 then true
14851450 else isMarketClosed())
14861451 then throw("Invalid closePosition parameters")
14871452 else {
1488- let oldPositionTimestamp = getPosition(_trader)._5
1489- let $t06943870023 = internalClosePosition(_trader, _size, positionFee, _minQuoteAssetAmount, _addToMargin, true, true)
1490- let newPositionSize = $t06943870023._1
1491- let newPositionMargin = $t06943870023._2
1492- let newPositionOpenNotional = $t06943870023._3
1493- let newPositionLstUpdCPF = $t06943870023._4
1494- let positionBadDebt = $t06943870023._5
1495- let realizedPnl = $t06943870023._6
1496- let marginToTrader = $t06943870023._7
1497- let quoteAssetReserveAfter = $t06943870023._8
1498- let baseAssetReserveAfter = $t06943870023._9
1499- let totalPositionSizeAfter = $t06943870023._10
1500- let openInterestNotionalAfter = $t06943870023._11
1501- let totalLongAfter = $t06943870023._12
1502- let totalShortAfter = $t06943870023._13
1503- let totalLongOpenInterestAfter = $t06943870023._14
1504- let totalShortOpenInterestAfter = $t06943870023._15
1505- let realizedFee = $t06943870023._16
1453+ let oldPositionTimestamp = getPosition(_trader, _direction)._5
1454+ let $t07006770670 = internalClosePosition(_trader, _direction, _size, positionFee, _minQuoteAssetAmount, _addToMargin, true, true)
1455+ let newPositionSize = $t07006770670._1
1456+ let newPositionMargin = $t07006770670._2
1457+ let newPositionOpenNotional = $t07006770670._3
1458+ let newPositionLstUpdCPF = $t07006770670._4
1459+ let positionBadDebt = $t07006770670._5
1460+ let realizedPnl = $t07006770670._6
1461+ let marginToTrader = $t07006770670._7
1462+ let quoteAssetReserveAfter = $t07006770670._8
1463+ let baseAssetReserveAfter = $t07006770670._9
1464+ let totalPositionSizeAfter = $t07006770670._10
1465+ let openInterestNotionalAfter = $t07006770670._11
1466+ let totalLongAfter = $t07006770670._12
1467+ let totalShortAfter = $t07006770670._13
1468+ let totalLongOpenInterestAfter = $t07006770670._14
1469+ let totalShortOpenInterestAfter = $t07006770670._15
1470+ let realizedFee = $t07006770670._16
15061471 if ((positionBadDebt > 0))
15071472 then throw("Invalid closePosition parameters: bad debt")
15081473 else if ((oldPositionTimestamp >= lastTimestamp()))
15171482 let unstake = invoke(vaultAddress(), "withdrawLocked", [withdrawAmount], nil)
15181483 if ((unstake == unstake))
15191484 then {
1520- let $t07069570754 = distributeFee(realizedFee)
1521- let feeToStakers = $t07069570754._1
1522- let feeToVault = $t07069570754._2
1523- let depositVault = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)])
1524- if ((depositVault == depositVault))
1485+ let referrerFeeAny = invoke(referralAddress(), "acceptPayment", [_trader], [AttachedPayment(quoteAsset(), realizedFee)])
1486+ if ((referrerFeeAny == referrerFeeAny))
15251487 then {
1526- let notifyFee = invoke(minerAddress(), "notifyFees", [_trader, realizedFee], nil)
1527- if ((notifyFee == notifyFee))
1488+ let referrerFee = match referrerFeeAny {
1489+ case x: Int =>
1490+ x
1491+ case _ =>
1492+ throw("Invalid referrerFee")
1493+ }
1494+ let $t07164271715 = distributeFee((realizedFee - referrerFee))
1495+ let feeToStakers = $t07164271715._1
1496+ let feeToVault = $t07164271715._2
1497+ let depositVault = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)])
1498+ if ((depositVault == depositVault))
15281499 then {
1529- let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, newPositionOpenNotional], nil)
1530- if ((notifyNotional == notifyNotional))
1531- then (((((if (isPartialClose)
1532- then updatePosition(_trader, newPositionSize, newPositionMargin, newPositionOpenNotional, newPositionLstUpdCPF, lastTimestamp())
1533- else deletePosition(_trader)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)) ++ (if ((marginToTrader > 0))
1534- then withdraw(_traderAddress, marginToTrader)
1535- else nil)) ++ updateBalance(ammNewBalance)) ++ transferFee(feeToStakers))
1500+ let notifyFee = invoke(minerAddress(), "notifyFees", [_trader, realizedFee], nil)
1501+ if ((notifyFee == notifyFee))
1502+ then {
1503+ let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, newPositionOpenNotional], nil)
1504+ if ((notifyNotional == notifyNotional))
1505+ then (((((if (isPartialClose)
1506+ then updatePosition(_trader, newPositionSize, newPositionMargin, newPositionOpenNotional, newPositionLstUpdCPF, lastTimestamp())
1507+ else deletePosition(_trader, _direction)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)) ++ (if ((marginToTrader > 0))
1508+ then withdraw(_traderAddress, marginToTrader)
1509+ else nil)) ++ updateBalance(ammNewBalance)) ++ transferFee(feeToStakers))
1510+ else throw("Strict value is not equal to itself.")
1511+ }
15361512 else throw("Strict value is not equal to itself.")
15371513 }
15381514 else throw("Strict value is not equal to itself.")
15511527
15521528
15531529 @Callable(i)
1554-func liquidate (_trader) = {
1530+func liquidate (_trader,_direction) = {
15551531 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
15561532 if ((sync == sync))
15571533 then {
1558- let spotMarginRatio = getMarginRatioByOption(_trader, PNL_OPTION_SPOT)
1534+ let spotMarginRatio = getMarginRatioByOption(_trader, _direction, PNL_OPTION_SPOT)
15591535 let liquidationMarginRatio = if (isOverFluctuationLimit())
15601536 then {
1561- let oracleMarginRatio = getMarginRatioByOption(_trader, PNL_OPTION_ORACLE)
1537+ let oracleMarginRatio = getMarginRatioByOption(_trader, _direction, PNL_OPTION_ORACLE)
15621538 vmax(spotMarginRatio, oracleMarginRatio)
15631539 }
15641540 else spotMarginRatio
15651541 if (if (if (if (if (!(requireMoreMarginRatio(liquidationMarginRatio, maintenanceMarginRatio(), false)))
15661542 then true
1567- else !(requireOpenPosition(_trader)))
1543+ else !(requireOpenPosition(_trader, _direction)))
15681544 then true
15691545 else !(initialized()))
15701546 then true
15781554 else false)
15791555 then (DECIMAL_UNIT > partialLiquidationRatio())
15801556 else false
1581- let oldPositionSize = getPosition(_trader)._1
1557+ let oldPositionSize = getPosition(_trader, _direction)._1
15821558 let positionSizeAbs = abs(oldPositionSize)
1583- let $t07317573498 = if (isPartialLiquidation)
1559+ let $t07421374536 = if (isPartialLiquidation)
15841560 then {
15851561 let liquidationSize = getPartialLiquidationAmount(_trader, oldPositionSize)
15861562 let liquidationRatio = divd(abs(liquidationSize), positionSizeAbs)
15871563 $Tuple2(liquidationRatio, abs(liquidationSize))
15881564 }
15891565 else $Tuple2(0, positionSizeAbs)
1590- let liquidationRatio = $t07317573498._1
1591- let liquidationSize = $t07317573498._2
1592- let $t07350474142 = internalClosePosition(_trader, if (isPartialLiquidation)
1566+ let liquidationRatio = $t07421374536._1
1567+ let liquidationSize = $t07421374536._2
1568+ let $t07454275198 = internalClosePosition(_trader, _direction, if (isPartialLiquidation)
15931569 then liquidationSize
15941570 else positionSizeAbs, liquidationFeeRatio(), 0, true, false, true)
1595- let newPositionSize = $t07350474142._1
1596- let newPositionMargin = $t07350474142._2
1597- let newPositionOpenNotional = $t07350474142._3
1598- let newPositionLstUpdCPF = $t07350474142._4
1599- let positionBadDebt = $t07350474142._5
1600- let realizedPnl = $t07350474142._6
1601- let marginToTrader = $t07350474142._7
1602- let quoteAssetReserveAfter = $t07350474142._8
1603- let baseAssetReserveAfter = $t07350474142._9
1604- let totalPositionSizeAfter = $t07350474142._10
1605- let openInterestNotionalAfter = $t07350474142._11
1606- let totalLongAfter = $t07350474142._12
1607- let totalShortAfter = $t07350474142._13
1608- let totalLongOpenInterestAfter = $t07350474142._14
1609- let totalShortOpenInterestAfter = $t07350474142._15
1610- let liquidationPenalty = $t07350474142._16
1571+ let newPositionSize = $t07454275198._1
1572+ let newPositionMargin = $t07454275198._2
1573+ let newPositionOpenNotional = $t07454275198._3
1574+ let newPositionLstUpdCPF = $t07454275198._4
1575+ let positionBadDebt = $t07454275198._5
1576+ let realizedPnl = $t07454275198._6
1577+ let marginToTrader = $t07454275198._7
1578+ let quoteAssetReserveAfter = $t07454275198._8
1579+ let baseAssetReserveAfter = $t07454275198._9
1580+ let totalPositionSizeAfter = $t07454275198._10
1581+ let openInterestNotionalAfter = $t07454275198._11
1582+ let totalLongAfter = $t07454275198._12
1583+ let totalShortAfter = $t07454275198._13
1584+ let totalLongOpenInterestAfter = $t07454275198._14
1585+ let totalShortOpenInterestAfter = $t07454275198._15
1586+ let liquidationPenalty = $t07454275198._16
16111587 let feeToLiquidator = (liquidationPenalty / 2)
16121588 let feeToVault = (liquidationPenalty - feeToLiquidator)
16131589 let ammBalance = (cbalance() - liquidationPenalty)
16341610 if ((notifyNotional == notifyNotional))
16351611 then ((((if (isPartialLiquidation)
16361612 then updatePosition(_trader, newPositionSize, newPositionMargin, newPositionOpenNotional, newPositionLstUpdCPF, lastTimestamp())
1637- else deletePosition(_trader)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)) ++ withdraw(i.caller, feeToLiquidator)) ++ updateBalance(newAmmBalance))
1613+ else deletePosition(_trader, _direction)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)) ++ withdraw(i.caller, feeToLiquidator)) ++ updateBalance(newAmmBalance))
16381614 else throw("Strict value is not equal to itself.")
16391615 }
16401616 else throw("Strict value is not equal to itself.")
16631639 then throw(((("Invalid funding block timestamp: " + toString(lastTimestamp())) + " < ") + toString(fundingBlockTimestamp)))
16641640 else {
16651641 let underlyingPrice = getOraclePrice()
1666- let $t07625576333 = getFunding()
1667- let shortPremiumFraction = $t07625576333._1
1668- let longPremiumFraction = $t07625576333._2
1669- let premiumToVault = $t07625576333._3
1642+ let $t07732377401 = getFunding()
1643+ let shortPremiumFraction = $t07732377401._1
1644+ let longPremiumFraction = $t07732377401._2
1645+ let premiumToVault = $t07732377401._3
16701646 let doPayFundingToVault = if ((premiumToVault > 0))
16711647 then {
16721648 let doPayFundingToVault = invoke(vaultAddress(), "exchangeFreeAndLocked", [-(premiumToVault)], nil)
16891665 func syncTerminalPriceToOracle () = {
16901666 let _qtAstR = qtAstR()
16911667 let _bsAstR = bsAstR()
1692- let $t07738477750 = getSyncTerminalPrice(getOraclePrice(), _qtAstR, _bsAstR)
1693- let newQuoteAssetWeight = $t07738477750._1
1694- let newBaseAssetWeight = $t07738477750._2
1695- let marginToVault = $t07738477750._3
1668+ let $t07845478820 = getSyncTerminalPrice(getOraclePrice(), _qtAstR, _bsAstR)
1669+ let newQuoteAssetWeight = $t07845478820._1
1670+ let newBaseAssetWeight = $t07845478820._2
1671+ let marginToVault = $t07845478820._3
16961672 let marginToVaultAdj = if (if ((0 > marginToVault))
16971673 then (abs(marginToVault) > cbalance())
16981674 else false)
17171693 func ensureCalledOnce () = if ((i.caller != this))
17181694 then throw("Invalid saveCurrentTxId parameters")
17191695 else {
1696+ let txId = toBase58String(i.transactionId)
17201697 let lastTx = valueOrElse(getString(this, k_lastTx), "")
1721- if ((lastTx != toBase58String(i.transactionId)))
1722- then [StringEntry(k_lastTx, lastTx)]
1698+ if ((lastTx != txId))
1699+ then [StringEntry(k_lastTx, txId)]
17231700 else throw("Can not call vAMM methods twice in one tx")
17241701 }
17251702
17261703
17271704
17281705 @Callable(i)
1729-func view_calcRemainMarginWithFundingPayment (_trader) = {
1706+func migratePosition (_trader) = {
1707+ let positionSizeOpt = getInteger(this, toCompositeKey(k_positionSize, _trader))
1708+ if (isDefined(positionSizeOpt))
1709+ then {
1710+ let pSize = getIntegerValue(this, toCompositeKey(k_positionSize, _trader))
1711+ let pMargin = getIntegerValue(this, toCompositeKey(k_positionMargin, _trader))
1712+ let pNotional = getIntegerValue(this, toCompositeKey(k_positionOpenNotional, _trader))
1713+ let pFraction = getIntegerValue(this, toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _trader))
1714+ let pTimestamp = getIntegerValue(this, toCompositeKey(k_positionLastUpdatedTimestamp, _trader))
1715+ let pFee = getIntegerValue(this, toCompositeKey(k_positionFee, _trader))
1716+ let pSequence = getIntegerValue(this, toCompositeKey(k_positionSequence, _trader))
1717+ let pDirection = getDirection(pSize)
1718+ let positionKey = ((_trader + "_") + toString(pDirection))
1719+[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)]
1720+ }
1721+ else throw(("Nothing to migrate for " + _trader))
1722+ }
1723+
1724+
1725+
1726+@Callable(i)
1727+func view_calcRemainMarginWithFundingPayment (_trader,_direction) = {
17301728 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
17311729 if ((sync == sync))
17321730 then {
1733- let $t07929979423 = getPosition(_trader)
1734- let positionSize = $t07929979423._1
1735- let positionMargin = $t07929979423._2
1736- let pon = $t07929979423._3
1737- let positionLstUpdCPF = $t07929979423._4
1738- let positionTimestamp = $t07929979423._5
1739- let $t07942679527 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1740- let positionNotional = $t07942679527._1
1741- let unrealizedPnl = $t07942679527._2
1742- let $t07953079754 = calcRemainMarginWithFundingPaymentAndRolloverFee(positionSize, positionMargin, positionLstUpdCPF, positionTimestamp, unrealizedPnl)
1743- let remainMargin = $t07953079754._1
1744- let badDebt = $t07953079754._2
1745- let fundingPayment = $t07953079754._3
1746- let rolloverFee = $t07953079754._4
1747- throw(((((((s(remainMargin) + s(fundingPayment)) + s(getMarginRatio(_trader))) + s(unrealizedPnl)) + s(badDebt)) + s(positionNotional)) + s(rolloverFee)))
1731+ let $t08243282568 = getPosition(_trader, _direction)
1732+ let positionSize = $t08243282568._1
1733+ let positionMargin = $t08243282568._2
1734+ let pon = $t08243282568._3
1735+ let positionLstUpdCPF = $t08243282568._4
1736+ let positionTimestamp = $t08243282568._5
1737+ let $t08257182684 = getPositionNotionalAndUnrealizedPnl(_trader, _direction, PNL_OPTION_SPOT)
1738+ let positionNotional = $t08257182684._1
1739+ let unrealizedPnl = $t08257182684._2
1740+ let $t08268782911 = calcRemainMarginWithFundingPaymentAndRolloverFee(positionSize, positionMargin, positionLstUpdCPF, positionTimestamp, unrealizedPnl)
1741+ let remainMargin = $t08268782911._1
1742+ let badDebt = $t08268782911._2
1743+ let fundingPayment = $t08268782911._3
1744+ let rolloverFee = $t08268782911._4
1745+ throw(((((((s(remainMargin) + s(fundingPayment)) + s(getMarginRatio(_trader, _direction))) + s(unrealizedPnl)) + s(badDebt)) + s(positionNotional)) + s(rolloverFee)))
17481746 }
17491747 else throw("Strict value is not equal to itself.")
17501748 }
17631761
17641762 @Callable(i)
17651763 func view_getTerminalAmmPrice () = {
1766- let $t08047780558 = getTerminalAmmState()
1767- let terminalQuoteAssetReserve = $t08047780558._1
1768- let terminalBaseAssetReserve = $t08047780558._2
1764+ let $t08364683727 = getTerminalAmmState()
1765+ let terminalQuoteAssetReserve = $t08364683727._1
1766+ let terminalBaseAssetReserve = $t08364683727._2
17691767 let price = divd(muld(terminalQuoteAssetReserve, qtAstW()), muld(terminalBaseAssetReserve, bsAstW()))
17701768 throw(toString(price))
17711769 }
17741772
17751773 @Callable(i)
17761774 func view_getFunding () = {
1777- let underlyingPrice = getOraclePrice()
1778- let $t08106781145 = getFunding()
1779- let shortPremiumFraction = $t08106781145._1
1780- let longPremiumFraction = $t08106781145._2
1781- let premiumToVault = $t08106781145._3
1782- let longFunding = divd(longPremiumFraction, underlyingPrice)
1783- let shortFunding = divd(shortPremiumFraction, underlyingPrice)
1784- throw(((((s(longFunding) + s(shortFunding)) + s(getSpotPrice())) + s(getOraclePrice())) + s(premiumToVault)))
1775+ let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
1776+ if ((sync == sync))
1777+ then {
1778+ let underlyingPrice = getOraclePrice()
1779+ let $t08428684364 = getFunding()
1780+ let shortPremiumFraction = $t08428684364._1
1781+ let longPremiumFraction = $t08428684364._2
1782+ let premiumToVault = $t08428684364._3
1783+ let longFunding = divd(longPremiumFraction, underlyingPrice)
1784+ let shortFunding = divd(shortPremiumFraction, underlyingPrice)
1785+ throw(((((s(longFunding) + s(shortFunding)) + s(getSpotPrice())) + s(getOraclePrice())) + s(premiumToVault)))
1786+ }
1787+ else throw("Strict value is not equal to itself.")
17851788 }
17861789
17871790
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let k_baseOracle = "k_baseOracle"
55
66 let k_quoteOracle = "k_quoteOracle"
77
88 let k_balance = "k_balance"
99
1010 let k_sequence = "k_sequence"
1111
1212 let k_positionSize = "k_positionSize"
1313
1414 let k_positionMargin = "k_positionMargin"
1515
1616 let k_positionOpenNotional = "k_positionOpenNotional"
1717
1818 let k_positionLastUpdatedCumulativePremiumFraction = "k_positionFraction"
1919
2020 let k_positionSequence = "k_positionSequence"
21-
22-let k_positionAsset = "k_positionAsset"
2321
2422 let k_positionFee = "k_positionFee"
2523
2624 let k_positionLastUpdatedTimestamp = "k_positionTimestamp"
2725
2826 let k_initialized = "k_initialized"
2927
3028 let k_paused = "k_paused"
3129
3230 let k_closeOnly = "k_closeOnly"
3331
3432 let k_fee = "k_fee"
3533
3634 let k_rolloverFee = "k_rollover_fee"
3735
3836 let k_fundingPeriod = "k_fundingPeriod"
3937
4038 let k_initMarginRatio = "k_initMarginRatio"
4139
4240 let k_maintenanceMarginRatio = "k_mmr"
4341
4442 let k_liquidationFeeRatio = "k_liquidationFeeRatio"
4543
4644 let k_partialLiquidationRatio = "k_partLiquidationRatio"
4745
4846 let k_spreadLimit = "k_spreadLimit"
4947
5048 let k_maxPriceImpact = "k_maxPriceImpact"
5149
5250 let k_maxPriceSpread = "k_maxPriceSpread"
5351
5452 let k_maxOpenNotional = "k_maxOpenNotional"
5553
5654 let k_feeToStakersPercent = "k_feeToStakersPercent"
5755
5856 let k_maxOracleDelay = "k_maxOracleDelay"
5957
6058 let k_fundingMode = "k_fundingMode"
6159
6260 let k_latestLongCumulativePremiumFraction = "k_latestLongPremiumFraction"
6361
6462 let k_latestShortCumulativePremiumFraction = "k_latestShortPremiumFraction"
6563
6664 let k_nextFundingBlock = "k_nextFundingBlockMinTimestamp"
6765
6866 let k_longFundingRate = "k_longFundingRate"
6967
7068 let k_shortFundingRate = "k_shortFundingRate"
7169
7270 let k_quoteAssetReserve = "k_qtAstR"
7371
7472 let k_baseAssetReserve = "k_bsAstR"
7573
7674 let k_quoteAssetWeight = "k_qtAstW"
7775
7876 let k_baseAssetWeight = "k_bsAstW"
7977
8078 let k_totalPositionSize = "k_totalPositionSize"
8179
8280 let k_totalLongPositionSize = "k_totalLongPositionSize"
8381
8482 let k_totalShortPositionSize = "k_totalShortPositionSize"
8583
8684 let k_openInterestNotional = "k_openInterestNotional"
8785
8886 let k_openInterestShort = "k_openInterestShort"
8987
9088 let k_openInterestLong = "k_openInterestLong"
9189
9290 let k_lastTx = "k_lastTx"
9391
9492 let k_coordinatorAddress = "k_coordinatorAddress"
9593
9694 let k_vault_address = "k_vault_address"
9795
9896 let k_admin_address = "k_admin_address"
9997
10098 let k_quote_asset = "k_quote_asset"
10199
102-let k_quote_staking = "k_quote_staking"
103-
104100 let k_staking_address = "k_staking_address"
105101
106102 let k_miner_address = "k_miner_address"
107103
108104 let k_orders_address = "k_orders_address"
109105
110106 let k_referral_address = "k_referral_address"
111-
112-let k_exchange_address = "k_exchange_address"
113107
114108 let k_nft_manager_address = "k_nft_manager_address"
115109
116110 func toCompositeKey (_key,_address) = ((_key + "_") + _address)
117111
118112
119113 func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set")
120114
121115
122116 func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address))
123117
124118
125119 func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset))
126-
127-
128-func quoteAssetStaking () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_quote_staking)), "Quote asset staking not set")
129120
130121
131122 func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), "Staking not set")
132123
133124
134125 func vaultAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_vault_address)), "Vault not set")
135126
136127
137128 func minerAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_miner_address)), "Miner not set")
138129
139130
140131 func ordersAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_orders_address)), "Orders not set")
141132
142133
143134 func referralAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_referral_address)), "Referral not set")
144135
145136
146137 func nftManagerAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_nft_manager_address)), "NFT Manager not set")
147138
148139
149140 let k_token_param = "k_token_param"
150141
151142 let k_token_type = "k_token_type"
152143
153144 let FEE_REDUCTION_TOKEN_TYPE = "fee_reduction"
154145
155146 let DIR_LONG = 1
156147
157148 let DIR_SHORT = 2
158-
159-let TWAP_INTERVAL = 15
160149
161150 let SECONDS = 1000
162151
163152 let DECIMAL_NUMBERS = 6
164153
165154 let DECIMAL_UNIT = (1 * (((((10 * 10) * 10) * 10) * 10) * 10))
166155
167156 let MINUTES_IN_YEAR = (525600 * DECIMAL_UNIT)
168157
169158 let ONE_DAY = (86400 * DECIMAL_UNIT)
170159
171160 let PNL_OPTION_SPOT = 1
172161
173162 let PNL_OPTION_ORACLE = 2
174163
175164 let FUNDING_ASYMMETRIC = 1
176165
177166 let FUNDING_SYMMETRIC = 2
178167
179168 func s (_x) = (toString(_x) + ",")
180169
181170
182171 func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN)
183172
184173
185174 func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN)
186175
187176
188177 func bdivd (_x,_y) = fraction(_x, toBigInt(DECIMAL_UNIT), _y, HALFEVEN)
189178
190179
191180 func bmuld (_x,_y) = fraction(_x, _y, toBigInt(DECIMAL_UNIT), HALFEVEN)
192181
193182
194183 func abs (_x) = if ((_x > 0))
195184 then _x
196185 else -(_x)
197186
198187
199188 func vmax (_x,_y) = if ((_x >= _y))
200189 then _x
201190 else _y
202-
203-
204-func listToStr (_list) = if ((size(_list) == 0))
205- then ""
206- else makeString(_list, ",")
207-
208-
209-func strToList (_str) = if ((_str == ""))
210- then nil
211- else split(_str, ",")
212-
213-
214-func pushToQueue (_list,_maxSize,_value) = if ((size(_list) > _maxSize))
215- then (removeByIndex(_list, 0) :+ _value)
216- else (_list :+ _value)
217191
218192
219193 func int (k) = valueOrErrorMessage(getInteger(this, k), ("no value for " + k))
220194
221195
222196 func intOr (k,def) = valueOrElse(getInteger(this, k), def)
223197
224198
225199 func strA (_address,_key) = {
226200 let val = valueOrErrorMessage(getString(_address, _key), ("No value for key " + _key))
227201 val
228202 }
229203
230204
231205 func intA (_address,_key) = {
232206 let val = valueOrErrorMessage(getInteger(_address, _key), ("No value for key " + _key))
233207 val
234208 }
235209
236210
237211 func cbalance () = int(k_balance)
238212
239213
240214 func fee () = int(k_fee)
241215
242216
243217 func rolloverFeeRate () = int(k_rolloverFee)
244218
245219
246220 func initMarginRatio () = int(k_initMarginRatio)
247221
248222
249223 func qtAstR () = int(k_quoteAssetReserve)
250224
251225
252226 func bsAstR () = int(k_baseAssetReserve)
253227
254228
255229 func qtAstW () = intOr(k_quoteAssetWeight, DECIMAL_UNIT)
256230
257231
258232 func bsAstW () = intOr(k_baseAssetWeight, DECIMAL_UNIT)
259233
260234
261235 func totalPositionSize () = int(k_totalPositionSize)
262236
263237
264238 func openInterestNotional () = int(k_openInterestNotional)
265239
266240
267241 func openInterestShort () = int(k_openInterestShort)
268242
269243
270244 func openInterestLong () = int(k_openInterestLong)
271245
272246
273247 func nextFundingBlockTimestamp () = int(k_nextFundingBlock)
274248
275249
276250 func fundingPeriodRaw () = int(k_fundingPeriod)
277251
278252
279253 func fundingPeriodDecimal () = (fundingPeriodRaw() * DECIMAL_UNIT)
280254
281255
282256 func fundingPeriodSeconds () = (fundingPeriodRaw() * SECONDS)
283257
284258
285259 func maintenanceMarginRatio () = int(k_maintenanceMarginRatio)
286260
287261
288262 func liquidationFeeRatio () = int(k_liquidationFeeRatio)
289263
290264
291265 func partialLiquidationRatio () = int(k_partialLiquidationRatio)
292266
293267
294268 func spreadLimit () = int(k_spreadLimit)
295269
296270
297271 func maxPriceImpact () = int(k_maxPriceImpact)
298272
299273
300274 func maxPriceSpread () = int(k_maxPriceSpread)
301275
302276
303277 func maxOpenNotional () = int(k_maxOpenNotional)
304278
305279
306280 func latestLongCumulativePremiumFraction () = int(k_latestLongCumulativePremiumFraction)
307281
308282
309283 func latestShortCumulativePremiumFraction () = int(k_latestShortCumulativePremiumFraction)
310284
311285
312286 func totalShortPositionSize () = int(k_totalShortPositionSize)
313287
314288
315289 func totalLongPositionSize () = int(k_totalLongPositionSize)
316290
317291
318292 func lastSequence () = intOr(k_sequence, 0)
319293
320294
321295 func feeToStakersPercent () = int(k_feeToStakersPercent)
322296
323297
324298 func maxOracleDelay () = int(k_maxOracleDelay)
325299
326300
327301 func fundingMode () = intOr(k_fundingMode, FUNDING_ASYMMETRIC)
328302
329303
330304 func lastTimestamp () = lastBlock.timestamp
331305
332306
333307 func getActualCaller (i) = valueOrElse(getString(ordersAddress(), "k_sender"), toString(i.caller))
334308
335309
336310 func requireMoreMarginRatio (_marginRatio,_baseMarginRatio,_largerThanOrEqualTo) = {
337311 let remainingMarginRatio = (_marginRatio - _baseMarginRatio)
338312 if (if (_largerThanOrEqualTo)
339313 then (0 > remainingMarginRatio)
340314 else false)
341315 then throw(((("Invalid margin: " + toString(_marginRatio)) + " < ") + toString(_baseMarginRatio)))
342316 else if (if (!(_largerThanOrEqualTo))
343317 then (remainingMarginRatio >= 0)
344318 else false)
345319 then throw(((("Invalid margin: " + toString(_marginRatio)) + " > ") + toString(_baseMarginRatio)))
346320 else true
347321 }
348322
349323
350324 func latestCumulativePremiumFraction (_positionSize) = if ((_positionSize == 0))
351325 then throw("Should not be called with _positionSize == 0")
352326 else if ((_positionSize > 0))
353327 then latestLongCumulativePremiumFraction()
354328 else latestShortCumulativePremiumFraction()
355329
356330
357-func getPosition (_trader) = {
358- let positionSizeOpt = getInteger(this, toCompositeKey(k_positionSize, _trader))
331+func getPosition (_trader,_direction) = {
332+ let positionKey = ((_trader + "_") + toString(_direction))
333+ let positionSizeOpt = getInteger(this, toCompositeKey(k_positionSize, positionKey))
359334 match positionSizeOpt {
360335 case positionSize: Int =>
361- $Tuple5(positionSize, getIntegerValue(this, toCompositeKey(k_positionMargin, _trader)), getIntegerValue(this, toCompositeKey(k_positionOpenNotional, _trader)), getIntegerValue(this, toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _trader)), getIntegerValue(this, toCompositeKey(k_positionLastUpdatedTimestamp, _trader)))
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)))
362337 case _ =>
363338 $Tuple5(0, 0, 0, 0, 0)
364339 }
365340 }
366341
367342
368-func getPositionAsset (_trader) = {
369- let positionAssetOpt = getString(this, toCompositeKey(k_positionAsset, _trader))
370- match positionAssetOpt {
371- case positionAsset: String =>
372- positionAsset
373- case _ =>
374- toBase58String(quoteAsset())
375- }
376- }
343+func getDirection (_positionSize) = if ((0 > _positionSize))
344+ then DIR_SHORT
345+ else DIR_LONG
377346
378347
379348 func getPositionFee (_trader) = {
380349 let positionFeeOpt = getInteger(this, toCompositeKey(k_positionFee, _trader))
381350 match positionFeeOpt {
382351 case positionFee: Int =>
383352 positionFee
384353 case _ =>
385354 fee()
386355 }
387356 }
388357
389358
390-func requireOpenPosition (_trader) = if ((getPosition(_trader)._1 == 0))
359+func requireOpenPosition (_trader,_direction) = if ((getPosition(_trader, _direction)._1 == 0))
391360 then throw("No open position")
392361 else true
393362
394363
395364 func getOracleData (key) = {
396365 let oracleDataStr = getString(this, key)
397366 if (if (isDefined(oracleDataStr))
398367 then (value(oracleDataStr) != "")
399368 else false)
400369 then {
401370 let oracleData = split(value(oracleDataStr), ",")
402371 let oracleAddress = valueOrErrorMessage(addressFromString(oracleData[0]), ("Invalid oracle address in: " + value(oracleDataStr)))
403372 let priceKey = oracleData[1]
404373 let blockKey = oracleData[2]
405374 let openKey = oracleData[3]
406375 $Tuple4(oracleAddress, priceKey, blockKey, openKey)
407376 }
408377 else unit
409378 }
410379
411380
412381 func initialized () = valueOrElse(getBoolean(this, k_initialized), false)
413382
414383
415384 func paused () = valueOrElse(getBoolean(this, k_paused), false)
416385
417386
418387 func closeOnly () = valueOrElse(getBoolean(this, k_closeOnly), false)
419388
420389
421390 func updateReserve (_isAdd,_quoteAssetAmount,_baseAssetAmount) = if (_isAdd)
422391 then {
423392 let newBase = (bsAstR() - _baseAssetAmount)
424393 if ((0 >= newBase))
425394 then throw("Tx lead to base asset reserve <= 0, revert")
426395 else $Tuple3((qtAstR() + _quoteAssetAmount), newBase, (totalPositionSize() + _baseAssetAmount))
427396 }
428397 else {
429398 let newQuote = (qtAstR() - _quoteAssetAmount)
430399 if ((0 >= newQuote))
431400 then throw("Tx lead to base quote reserve <= 0, revert")
432401 else $Tuple3(newQuote, (bsAstR() + _baseAssetAmount), (totalPositionSize() - _baseAssetAmount))
433402 }
434403
435404
436405 func calcInvariant (_qtAstR,_bsAstR) = {
437406 let bqtAstR = toBigInt(_qtAstR)
438407 let bbsAstR = toBigInt(_bsAstR)
439408 bmuld(bqtAstR, bbsAstR)
440409 }
441410
442411
443412 func swapInput (_isAdd,_quoteAssetAmount) = {
444413 let _qtAstR = qtAstR()
445414 let _bsAstR = bsAstR()
446415 let _qtAstW = qtAstW()
447416 let _bsAstW = bsAstW()
448417 let quoteAssetAmountAdjusted = divd(_quoteAssetAmount, _qtAstW)
449418 let k = calcInvariant(_qtAstR, _bsAstR)
450419 let quoteAssetReserveAfter = if (_isAdd)
451420 then (_qtAstR + quoteAssetAmountAdjusted)
452421 else (_qtAstR - quoteAssetAmountAdjusted)
453422 let baseAssetReserveAfter = toInt(bdivd(k, toBigInt(quoteAssetReserveAfter)))
454423 let amountBaseAssetBoughtAbs = abs((baseAssetReserveAfter - _bsAstR))
455424 let amountBaseAssetBought = if (_isAdd)
456425 then amountBaseAssetBoughtAbs
457426 else -(amountBaseAssetBoughtAbs)
458- let $t01635216522 = updateReserve(_isAdd, quoteAssetAmountAdjusted, amountBaseAssetBoughtAbs)
459- let quoteAssetReserveAfter1 = $t01635216522._1
460- let baseAssetReserveAfter1 = $t01635216522._2
461- let totalPositionSizeAfter1 = $t01635216522._3
427+ let $t01550515675 = updateReserve(_isAdd, quoteAssetAmountAdjusted, amountBaseAssetBoughtAbs)
428+ let quoteAssetReserveAfter1 = $t01550515675._1
429+ let baseAssetReserveAfter1 = $t01550515675._2
430+ let totalPositionSizeAfter1 = $t01550515675._3
462431 let priceBefore = divd(muld(_qtAstR, _qtAstW), muld(_bsAstR, _bsAstW))
463432 let marketPrice = divd(_quoteAssetAmount, amountBaseAssetBoughtAbs)
464433 let priceDiff = abs((priceBefore - marketPrice))
465434 let priceImpact = (DECIMAL_UNIT - divd(priceBefore, (priceBefore + priceDiff)))
466435 let maxPriceImpactValue = maxPriceImpact()
467436 if ((priceImpact > maxPriceImpactValue))
468437 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)))
469438 else $Tuple4(amountBaseAssetBought, quoteAssetReserveAfter1, baseAssetReserveAfter1, totalPositionSizeAfter1)
470439 }
471440
472441
473442 func calcRolloverFee (_oldPositionMargin,_oldPositionLastUpdatedTimestamp) = {
474443 let positionMinutes = ((((lastTimestamp() - _oldPositionLastUpdatedTimestamp) / 1000) / 60) * DECIMAL_UNIT)
475444 let rolloverFee = divd(muld(muld(_oldPositionMargin, positionMinutes), rolloverFeeRate()), MINUTES_IN_YEAR)
476445 rolloverFee
477446 }
478447
479448
480449 func calcRemainMarginWithFundingPaymentAndRolloverFee (_oldPositionSize,_oldPositionMargin,_oldPositionCumulativePremiumFraction,_oldPositionLastUpdatedTimestamp,_marginDelta) = {
481450 let fundingPayment = if ((_oldPositionSize != 0))
482451 then {
483452 let _latestCumulativePremiumFraction = latestCumulativePremiumFraction(_oldPositionSize)
484453 muld((_latestCumulativePremiumFraction - _oldPositionCumulativePremiumFraction), _oldPositionSize)
485454 }
486455 else 0
487456 let rolloverFee = calcRolloverFee(_oldPositionMargin, _oldPositionLastUpdatedTimestamp)
488457 let signedMargin = (((_marginDelta - rolloverFee) - fundingPayment) + _oldPositionMargin)
489- let $t01877718904 = if ((0 > signedMargin))
458+ let $t01834218469 = if ((0 > signedMargin))
490459 then $Tuple2(0, abs(signedMargin))
491460 else $Tuple2(abs(signedMargin), 0)
492- let remainMargin = $t01877718904._1
493- let badDebt = $t01877718904._2
461+ let remainMargin = $t01834218469._1
462+ let badDebt = $t01834218469._2
494463 $Tuple4(remainMargin, badDebt, fundingPayment, rolloverFee)
495464 }
496465
497466
498467 func swapOutputWithReserves (_isAdd,_baseAssetAmount,_checkMaxPriceImpact,_quoteAssetReserve,_quoteAssetWeight,_baseAssetReserve,_baseAssetWeight) = {
499468 let priceBefore = divd(muld(_quoteAssetReserve, _quoteAssetWeight), muld(_baseAssetReserve, _baseAssetWeight))
500469 if ((_baseAssetAmount == 0))
501470 then throw("Invalid base asset amount")
502471 else {
503472 let k = calcInvariant(_quoteAssetReserve, _baseAssetReserve)
504473 let baseAssetPoolAmountAfter = if (_isAdd)
505474 then (_baseAssetReserve + _baseAssetAmount)
506475 else (_baseAssetReserve - _baseAssetAmount)
507476 let quoteAssetAfter = toInt(bdivd(k, toBigInt(baseAssetPoolAmountAfter)))
508477 let quoteAssetDelta = abs((quoteAssetAfter - _quoteAssetReserve))
509478 let quoteAssetSold = muld(quoteAssetDelta, _quoteAssetWeight)
510479 let maxPriceImpactValue = maxPriceImpact()
511- let $t02016620328 = updateReserve(!(_isAdd), quoteAssetDelta, _baseAssetAmount)
512- let quoteAssetReserveAfter1 = $t02016620328._1
513- let baseAssetReserveAfter1 = $t02016620328._2
514- let totalPositionSizeAfter1 = $t02016620328._3
480+ let $t01973119893 = updateReserve(!(_isAdd), quoteAssetDelta, _baseAssetAmount)
481+ let quoteAssetReserveAfter1 = $t01973119893._1
482+ let baseAssetReserveAfter1 = $t01973119893._2
483+ let totalPositionSizeAfter1 = $t01973119893._3
515484 let marketPrice = divd(quoteAssetSold, _baseAssetAmount)
516485 let priceDiff = abs((priceBefore - marketPrice))
517486 let priceImpact = (DECIMAL_UNIT - divd(priceBefore, (priceBefore + priceDiff)))
518487 if (if ((priceImpact > maxPriceImpactValue))
519488 then _checkMaxPriceImpact
520489 else false)
521490 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)))
522491 else $Tuple7(quoteAssetSold, quoteAssetReserveAfter1, baseAssetReserveAfter1, totalPositionSizeAfter1, (totalLongPositionSize() - (if (_isAdd)
523492 then abs(_baseAssetAmount)
524493 else 0)), (totalShortPositionSize() - (if (!(_isAdd))
525494 then abs(_baseAssetAmount)
526495 else 0)), priceImpact)
527496 }
528497 }
529498
530499
531500 func swapOutput (_isAdd,_baseAssetAmount,_checkMaxPriceImpact) = swapOutputWithReserves(_isAdd, _baseAssetAmount, _checkMaxPriceImpact, qtAstR(), qtAstW(), bsAstR(), bsAstW())
532501
533502
534503 func getOraclePriceValue (oracle,priceKey,blockKey) = {
535504 let lastValue = valueOrErrorMessage(getInteger(oracle, priceKey), ((("Can not get oracle price. Oracle: " + toString(oracle)) + " key: ") + priceKey))
536505 if ((blockKey != ""))
537506 then {
538507 let currentBlock = lastBlock.height
539508 let lastOracleBlock = valueOrErrorMessage(getInteger(oracle, blockKey), ((("Can not get oracle block. Oracle: " + toString(oracle)) + " key: ") + blockKey))
540509 if (((currentBlock - lastOracleBlock) > maxOracleDelay()))
541510 then throw(((("Oracle stale data. Last oracle block: " + toString(lastOracleBlock)) + " current block: ") + toString(currentBlock)))
542511 else lastValue
543512 }
544513 else lastValue
545514 }
546515
547516
548517 func getOraclePrice () = {
549518 let baseOracle = valueOrErrorMessage(getOracleData(k_baseOracle), "No base asset oracle data")
550519 let baseOraclePrice = getOraclePriceValue(baseOracle._1, baseOracle._2, baseOracle._3)
551520 let quoteOracle = getOracleData(k_quoteOracle)
552521 let quoteOraclePrice = if (isDefined(quoteOracle))
553522 then {
554523 let quoteOracleV = value(quoteOracle)
555524 getOraclePriceValue(quoteOracleV._1, quoteOracleV._2, quoteOracleV._3)
556525 }
557526 else DECIMAL_UNIT
558527 divd(baseOraclePrice, quoteOraclePrice)
559528 }
560529
561530
562531 func isMarketClosed () = {
563532 let baseOracle = valueOrErrorMessage(getOracleData(k_baseOracle), "No base asset oracle data")
564533 let oracle = baseOracle._1
565534 let openKey = baseOracle._4
566535 if ((openKey != ""))
567536 then {
568537 let isOpen = valueOrErrorMessage(getBoolean(oracle, openKey), ((("Can not get oracle is open/closed. Oracle: " + toString(oracle)) + " key: ") + openKey))
569538 !(isOpen)
570539 }
571540 else false
572541 }
573542
574543
575544 func absPriceDiff (_oraclePrice,_quoteAssetReserve,_baseAssetReserve,_qtAstW,_bsAstW) = {
576545 let priceAfter = divd(muld(_quoteAssetReserve, _qtAstW), muld(_baseAssetReserve, _bsAstW))
577546 let averagePrice = divd((_oraclePrice + priceAfter), (2 * DECIMAL_UNIT))
578547 let absPriceDiff = divd(abs((_oraclePrice - priceAfter)), averagePrice)
579548 absPriceDiff
580549 }
581550
582551
583552 func requireNotOverSpreadLimit (_quoteAssetReserve,_baseAssetReserve) = {
584553 let oraclePrice = getOraclePrice()
585554 let _qtAstW = qtAstW()
586555 let _bsAstW = bsAstW()
587556 let absPriceDiffBefore = absPriceDiff(oraclePrice, qtAstR(), bsAstR(), _qtAstW, _bsAstW)
588557 let absPriceDiffAfter = absPriceDiff(oraclePrice, _quoteAssetReserve, _baseAssetReserve, _qtAstW, _bsAstW)
589558 if (if ((absPriceDiffAfter > maxPriceSpread()))
590559 then (absPriceDiffAfter > absPriceDiffBefore)
591560 else false)
592561 then throw(((("Price spread " + toString(absPriceDiffAfter)) + " > max price spread ") + toString(maxPriceSpread())))
593562 else true
594563 }
595564
596565
597566 func requireNotOverMaxOpenNotional (_longOpenNotional,_shortOpenNotional) = {
598567 let _maxOpenNotional = maxOpenNotional()
599568 if ((_longOpenNotional > _maxOpenNotional))
600569 then throw(((("Long open notional " + toString(_longOpenNotional)) + " > max open notional ") + toString(_maxOpenNotional)))
601570 else if ((_shortOpenNotional > _maxOpenNotional))
602571 then throw(((("Short open notional " + toString(_shortOpenNotional)) + " > max open notional ") + toString(_maxOpenNotional)))
603572 else true
604573 }
605574
606575
607576 func getSpotPrice () = {
608577 let _quoteAssetReserve = qtAstR()
609578 let _baseAssetReserve = bsAstR()
610579 let _qtAstW = qtAstW()
611580 let _bsAstW = bsAstW()
612581 divd(muld(_quoteAssetReserve, _qtAstW), muld(_baseAssetReserve, _bsAstW))
613582 }
614583
615584
616585 func isOverFluctuationLimit () = {
617586 let oraclePrice = getOraclePrice()
618587 let currentPrice = getSpotPrice()
619588 (divd(abs((oraclePrice - currentPrice)), oraclePrice) > spreadLimit())
620589 }
621590
622591
623592 func getPositionAdjustedOpenNotional (_positionSize,_option,_quoteAssetReserve,_quoteAssetWeight,_baseAssetReserve,_baseAssetWeight) = {
624593 let positionSizeAbs = abs(_positionSize)
625594 let isShort = (0 > _positionSize)
626595 let positionNotional = if ((_option == PNL_OPTION_SPOT))
627596 then {
628597 let outPositionNotional = swapOutputWithReserves(!(isShort), positionSizeAbs, false, _quoteAssetReserve, _quoteAssetWeight, _baseAssetReserve, _baseAssetWeight)._1
629598 outPositionNotional
630599 }
631600 else muld(positionSizeAbs, getOraclePrice())
632601 positionNotional
633602 }
634603
635604
636605 func getPositionNotionalAndUnrealizedPnlByValues (_positionSize,_positionOpenNotional,_quoteAssetReserve,_quoteAssetWeight,_baseAssetReserve,_baseAssetWeight,_option) = if ((_positionSize == 0))
637606 then throw("Invalid position size")
638607 else {
639608 let isShort = (0 > _positionSize)
640609 let positionNotional = getPositionAdjustedOpenNotional(_positionSize, _option, _quoteAssetReserve, _quoteAssetWeight, _baseAssetReserve, _baseAssetWeight)
641610 let unrealizedPnl = if (isShort)
642611 then (_positionOpenNotional - positionNotional)
643612 else (positionNotional - _positionOpenNotional)
644613 $Tuple2(positionNotional, unrealizedPnl)
645614 }
646615
647616
648-func getPositionNotionalAndUnrealizedPnl (_trader,_option) = {
649- let $t02820628334 = getPosition(_trader)
650- let positionSize = $t02820628334._1
651- let positionMargin = $t02820628334._2
652- let positionOpenNotional = $t02820628334._3
653- let positionLstUpdCPF = $t02820628334._4
617+func getPositionNotionalAndUnrealizedPnl (_trader,_direction,_option) = {
618+ let $t02778827928 = getPosition(_trader, _direction)
619+ let positionSize = $t02778827928._1
620+ let positionMargin = $t02778827928._2
621+ let positionOpenNotional = $t02778827928._3
622+ let positionLstUpdCPF = $t02778827928._4
654623 getPositionNotionalAndUnrealizedPnlByValues(positionSize, positionOpenNotional, qtAstR(), qtAstW(), bsAstR(), bsAstW(), _option)
655624 }
656625
657626
658627 func calcMarginRatio (_remainMargin,_badDebt,_positionNotional) = divd((_remainMargin - _badDebt), _positionNotional)
659628
660629
661-func getMarginRatioByOption (_trader,_option) = {
662- let $t02884928990 = getPosition(_trader)
663- let positionSize = $t02884928990._1
664- let positionMargin = $t02884928990._2
665- let pon = $t02884928990._3
666- let positionLastUpdatedCPF = $t02884928990._4
667- let positionTimestamp = $t02884928990._5
668- let $t02899629089 = getPositionNotionalAndUnrealizedPnl(_trader, _option)
669- let positionNotional = $t02899629089._1
670- let unrealizedPnl = $t02899629089._2
671- let $t02909429306 = calcRemainMarginWithFundingPaymentAndRolloverFee(positionSize, positionMargin, positionLastUpdatedCPF, positionTimestamp, unrealizedPnl)
672- let remainMargin = $t02909429306._1
673- let badDebt = $t02909429306._2
630+func getMarginRatioByOption (_trader,_direction,_option) = {
631+ let $t02846028613 = getPosition(_trader, _direction)
632+ let positionSize = $t02846028613._1
633+ let positionMargin = $t02846028613._2
634+ let pon = $t02846028613._3
635+ let positionLastUpdatedCPF = $t02846028613._4
636+ let positionTimestamp = $t02846028613._5
637+ let $t02861928724 = getPositionNotionalAndUnrealizedPnl(_trader, _direction, _option)
638+ let positionNotional = $t02861928724._1
639+ let unrealizedPnl = $t02861928724._2
640+ let $t02872928941 = calcRemainMarginWithFundingPaymentAndRolloverFee(positionSize, positionMargin, positionLastUpdatedCPF, positionTimestamp, unrealizedPnl)
641+ let remainMargin = $t02872928941._1
642+ let badDebt = $t02872928941._2
674643 calcMarginRatio(remainMargin, badDebt, positionNotional)
675644 }
676645
677646
678-func getMarginRatio (_trader) = getMarginRatioByOption(_trader, PNL_OPTION_SPOT)
647+func getMarginRatio (_trader,_direction) = getMarginRatioByOption(_trader, _direction, PNL_OPTION_SPOT)
679648
680649
681650 func getPartialLiquidationAmount (_trader,_positionSize) = {
682- let maximumRatio = vmax(partialLiquidationRatio(), (DECIMAL_UNIT - divd(getMarginRatio(_trader), maintenanceMarginRatio())))
651+ let maximumRatio = vmax(partialLiquidationRatio(), (DECIMAL_UNIT - divd(getMarginRatio(_trader, getDirection(_positionSize)), maintenanceMarginRatio())))
683652 let maxExchangedPositionSize = muld(abs(_positionSize), maximumRatio)
684653 let swapResult = swapOutput((_positionSize > 0), maxExchangedPositionSize, false)
685654 let maxExchangedQuoteAssetAmount = swapResult._1
686655 let priceImpact = swapResult._7
687656 if ((maxPriceImpact() > priceImpact))
688657 then maxExchangedPositionSize
689658 else muld(abs(_positionSize), partialLiquidationRatio())
690659 }
691660
692661
693-func internalClosePosition (_trader,_size,_fee,_minQuoteAssetAmount,_addToMargin,_checkMaxPriceImpact,_liquidate) = {
694- let $t03037330529 = getPosition(_trader)
695- let oldPositionSize = $t03037330529._1
696- let oldPositionMargin = $t03037330529._2
697- let oldPositionOpenNotional = $t03037330529._3
698- let oldPositionLstUpdCPF = $t03037330529._4
699- let oldPositionTimestamp = $t03037330529._5
662+func internalClosePosition (_trader,_direction,_size,_fee,_minQuoteAssetAmount,_addToMargin,_checkMaxPriceImpact,_liquidate) = {
663+ let $t03010430272 = getPosition(_trader, _direction)
664+ let oldPositionSize = $t03010430272._1
665+ let oldPositionMargin = $t03010430272._2
666+ let oldPositionOpenNotional = $t03010430272._3
667+ let oldPositionLstUpdCPF = $t03010430272._4
668+ let oldPositionTimestamp = $t03010430272._5
700669 let isLongPosition = (oldPositionSize > 0)
701670 let absOldPositionSize = abs(oldPositionSize)
702671 if (if ((absOldPositionSize >= _size))
703672 then (_size > 0)
704673 else false)
705674 then {
706675 let isPartialClose = (absOldPositionSize > _size)
707- let $t03082131272 = swapOutput((oldPositionSize > 0), _size, _checkMaxPriceImpact)
708- let exchangedQuoteAssetAmount = $t03082131272._1
709- let quoteAssetReserveAfter = $t03082131272._2
710- let baseAssetReserveAfter = $t03082131272._3
711- let totalPositionSizeAfter = $t03082131272._4
676+ let $t03056431015 = swapOutput((oldPositionSize > 0), _size, _checkMaxPriceImpact)
677+ let exchangedQuoteAssetAmount = $t03056431015._1
678+ let quoteAssetReserveAfter = $t03056431015._2
679+ let baseAssetReserveAfter = $t03056431015._3
680+ let totalPositionSizeAfter = $t03056431015._4
712681 let exchangedPositionSize = if ((oldPositionSize > 0))
713682 then -(_size)
714683 else _size
715- let $t03148731694 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
716- let oldPositionNotional = $t03148731694._1
717- let unrealizedPnl = $t03148731694._2
684+ let $t03123031454 = getPositionNotionalAndUnrealizedPnl(_trader, _direction, PNL_OPTION_SPOT)
685+ let oldPositionNotional = $t03123031454._1
686+ let unrealizedPnl = $t03123031454._2
718687 let realizedRatio = divd(abs(exchangedPositionSize), absOldPositionSize)
719688 let realizedPnl = muld(unrealizedPnl, realizedRatio)
720- let $t03203532281 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, unrealizedPnl)
721- let remainMarginBefore = $t03203532281._1
722- let x1 = $t03203532281._2
723- let x2 = $t03203532281._3
724- let rolloverFee = $t03203532281._4
689+ let $t03179532041 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, unrealizedPnl)
690+ let remainMarginBefore = $t03179532041._1
691+ let x1 = $t03179532041._2
692+ let x2 = $t03179532041._3
693+ let rolloverFee = $t03179532041._4
725694 let positionBadDebt = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, realizedPnl)._2
726695 let realizedCloseFee = muld(muld(oldPositionNotional, realizedRatio), _fee)
727696 let unrealizedPnlAfter = (unrealizedPnl - realizedPnl)
728697 let remainOpenNotional = if ((oldPositionSize > 0))
729698 then ((oldPositionNotional - exchangedQuoteAssetAmount) - unrealizedPnlAfter)
730699 else ((unrealizedPnlAfter + oldPositionNotional) - exchangedQuoteAssetAmount)
731700 let newPositionSize = (oldPositionSize + exchangedPositionSize)
732- let $t03368734073 = if ((newPositionSize == 0))
701+ let $t03344733833 = if ((newPositionSize == 0))
733702 then $Tuple2(0, 0)
734703 else $Tuple2(abs(remainOpenNotional), latestCumulativePremiumFraction(newPositionSize))
735- let newPositionOpenNotional = $t03368734073._1
736- let newPositionLstUpdCPF = $t03368734073._2
704+ let newPositionOpenNotional = $t03344733833._1
705+ let newPositionLstUpdCPF = $t03344733833._2
737706 let openNotionalDelta = (oldPositionOpenNotional - newPositionOpenNotional)
738- let marginRatio = getMarginRatioByOption(_trader, PNL_OPTION_SPOT)
707+ let marginRatio = getMarginRatioByOption(_trader, _direction, PNL_OPTION_SPOT)
739708 let newPositionMarginWithSameRatio = if ((oldPositionSize > 0))
740709 then (muld((newPositionOpenNotional + unrealizedPnlAfter), marginRatio) - unrealizedPnlAfter)
741710 else (muld((newPositionOpenNotional - unrealizedPnlAfter), marginRatio) - unrealizedPnlAfter)
742711 let marginToTraderRaw = ((remainMarginBefore - (newPositionMarginWithSameRatio + unrealizedPnlAfter)) - realizedCloseFee)
743712 let marginToTrader = if ((0 > marginToTraderRaw))
744713 then if (_liquidate)
745714 then 0
746715 else throw("Invalid internalClosePosition params: unable to pay fee")
747716 else marginToTraderRaw
748717 let newPositionMargin = if (_addToMargin)
749718 then (newPositionMarginWithSameRatio + marginToTrader)
750719 else newPositionMarginWithSameRatio
751720 if (if ((_minQuoteAssetAmount != 0))
752721 then (_minQuoteAssetAmount > exchangedQuoteAssetAmount)
753722 else false)
754723 then throw(((("Limit error: " + toString(exchangedQuoteAssetAmount)) + " < ") + toString(_minQuoteAssetAmount)))
755724 else $Tuple17(newPositionSize, newPositionMargin, newPositionOpenNotional, newPositionLstUpdCPF, positionBadDebt, realizedPnl, if (if (_addToMargin)
756725 then isPartialClose
757726 else false)
758727 then 0
759728 else marginToTrader, quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, (openInterestNotional() - openNotionalDelta), (totalLongPositionSize() - (if (isLongPosition)
760729 then abs(exchangedPositionSize)
761730 else 0)), (totalShortPositionSize() - (if (!(isLongPosition))
762731 then abs(exchangedPositionSize)
763732 else 0)), (openInterestLong() - (if (isLongPosition)
764733 then openNotionalDelta
765734 else 0)), (openInterestShort() - (if (!(isLongPosition))
766735 then openNotionalDelta
767736 else 0)), (realizedCloseFee + rolloverFee), exchangedQuoteAssetAmount)
768737 }
769738 else throw(((("Invalid internalClosePosition params: invalid position size: " + toString(_size)) + " max: ") + toString(absOldPositionSize)))
770739 }
771740
772741
773742 func getTerminalAmmState () = {
774743 let _positionSize = totalPositionSize()
775744 if ((_positionSize == 0))
776745 then $Tuple2(qtAstR(), bsAstR())
777746 else {
778747 let direction = (_positionSize > 0)
779- let $t03730837487 = swapOutput(direction, abs(_positionSize), false)
780- let currentNetMarketValue = $t03730837487._1
781- let terminalQuoteAssetReserve = $t03730837487._2
782- let terminalBaseAssetReserve = $t03730837487._3
748+ let $t03708037259 = swapOutput(direction, abs(_positionSize), false)
749+ let currentNetMarketValue = $t03708037259._1
750+ let terminalQuoteAssetReserve = $t03708037259._2
751+ let terminalBaseAssetReserve = $t03708037259._3
783752 $Tuple2(terminalQuoteAssetReserve, terminalBaseAssetReserve)
784753 }
785754 }
786755
787756
788757 func getQuoteAssetWeight (baseAssetReserve,totalPositionSize,quoteAssetReserve,targetPrice) = {
789758 let b = toBigInt(baseAssetReserve)
790759 let sz = toBigInt(totalPositionSize)
791760 let q = toBigInt(quoteAssetReserve)
792761 let p = toBigInt(targetPrice)
793762 let k = bmuld(q, b)
794763 let newB = (b + sz)
795764 let newQ = bdivd(k, newB)
796765 let z = bdivd(newQ, newB)
797766 let result = bdivd(p, z)
798767 toInt(result)
799768 }
800769
801770
802771 func getSyncTerminalPrice (_terminalPrice,_qtAstR,_bsAstR) = {
803772 let _positionSize = totalPositionSize()
804773 if ((_positionSize == 0))
805774 then {
806775 let newQtAstW = divd(muld(_terminalPrice, _bsAstR), _qtAstR)
807776 $Tuple3(newQtAstW, DECIMAL_UNIT, 0)
808777 }
809778 else {
810779 let direction = (_positionSize > 0)
811780 let currentNetMarketValue = swapOutput(direction, abs(_positionSize), false)._1
812781 let newQtAstW = getQuoteAssetWeight(_bsAstR, _positionSize, _qtAstR, _terminalPrice)
813782 let newBsAstW = DECIMAL_UNIT
814783 let marginToVault = getPositionNotionalAndUnrealizedPnlByValues(_positionSize, currentNetMarketValue, _qtAstR, newQtAstW, _bsAstR, newBsAstW, PNL_OPTION_SPOT)._2
815784 $Tuple3(newQtAstW, newBsAstW, marginToVault)
816785 }
817786 }
818787
819788
820789 func getFunding () = {
821790 let underlyingPrice = getOraclePrice()
822- let spotTwapPrice = getSpotPrice()
823- let premium = (spotTwapPrice - underlyingPrice)
791+ let spotPrice = getSpotPrice()
792+ let premium = (spotPrice - underlyingPrice)
824793 if (if (if ((totalShortPositionSize() == 0))
825794 then true
826795 else (totalLongPositionSize() == 0))
827796 then true
828797 else isMarketClosed())
829798 then $Tuple3(0, 0, 0)
830799 else if ((0 > premium))
831800 then {
832801 let shortPremiumFraction = divd(muld(premium, fundingPeriodDecimal()), ONE_DAY)
833802 if ((fundingMode() == FUNDING_ASYMMETRIC))
834803 then {
835804 let longPremiumFraction = divd(muld(shortPremiumFraction, totalShortPositionSize()), totalLongPositionSize())
836805 $Tuple3(shortPremiumFraction, longPremiumFraction, 0)
837806 }
838807 else {
839808 let shortTotalPremiumFraction = abs(muld(shortPremiumFraction, totalShortPositionSize()))
840809 let longTotalPremiumFraction = abs(muld(shortPremiumFraction, totalLongPositionSize()))
841810 let premiumToVault = (shortTotalPremiumFraction - longTotalPremiumFraction)
842811 $Tuple3(shortPremiumFraction, shortPremiumFraction, premiumToVault)
843812 }
844813 }
845814 else {
846815 let longPremiumFraction = divd(muld(premium, fundingPeriodDecimal()), ONE_DAY)
847816 if ((fundingMode() == FUNDING_ASYMMETRIC))
848817 then {
849818 let shortPremiumFraction = divd(muld(longPremiumFraction, totalLongPositionSize()), totalShortPositionSize())
850819 $Tuple3(shortPremiumFraction, longPremiumFraction, 0)
851820 }
852821 else {
853822 let longTotalPremiumFraction = abs(muld(longPremiumFraction, totalLongPositionSize()))
854823 let shortTotalPremiumFraction = abs(muld(longPremiumFraction, totalShortPositionSize()))
855824 let premiumToVault = (longTotalPremiumFraction - shortTotalPremiumFraction)
856825 $Tuple3(longPremiumFraction, longPremiumFraction, premiumToVault)
857826 }
858827 }
859828 }
860829
861830
862831 func getAdjustedFee (_artifactId,_baseFeeDiscount) = {
863832 let baseFeeRaw = fee()
864833 let baseFee = muld(baseFeeRaw, _baseFeeDiscount)
865- let $t04122941724 = if ((_artifactId != ""))
834+ let $t04183442329 = if ((_artifactId != ""))
866835 then {
867836 let artifactKind = strA(nftManagerAddress(), toCompositeKey(k_token_type, _artifactId))
868837 if ((artifactKind == FEE_REDUCTION_TOKEN_TYPE))
869838 then {
870839 let reduction = intA(nftManagerAddress(), toCompositeKey(k_token_param, _artifactId))
871840 let adjustedFee = muld(baseFee, reduction)
872841 $Tuple2(adjustedFee, true)
873842 }
874843 else throw("Invalid attached artifact")
875844 }
876845 else $Tuple2(baseFee, false)
877- let adjustedFee = $t04122941724._1
878- let burnArtifact = $t04122941724._2
846+ let adjustedFee = $t04183442329._1
847+ let burnArtifact = $t04183442329._2
879848 $Tuple2(adjustedFee, burnArtifact)
880849 }
881-
882-
883-func isSameAssetOrNoPosition (_trader,_assetId) = {
884- let oldPositionSize = getPosition(_trader)._1
885- if ((oldPositionSize == 0))
886- then true
887- else (getPositionAsset(_trader) == _assetId)
888- }
889-
890-
891-func isSameAsset (_trader,_assetId) = (getPositionAsset(_trader) == _assetId)
892850
893851
894852 func getForTraderWithArtifact (_trader,_artifactId) = {
895853 let doGetFeeDiscount = invoke(minerAddress(), "computeFeeDiscount", [_trader], nil)
896854 if ((doGetFeeDiscount == doGetFeeDiscount))
897855 then {
898856 let feeDiscount = match doGetFeeDiscount {
899857 case x: Int =>
900858 x
901859 case _ =>
902860 throw("Invalid computeFeeDiscount result")
903861 }
904- let $t04240442478 = getAdjustedFee(_artifactId, feeDiscount)
905- let adjustedFee = $t04240442478._1
906- let burnArtifact = $t04240442478._2
862+ let $t04267542749 = getAdjustedFee(_artifactId, feeDiscount)
863+ let adjustedFee = $t04267542749._1
864+ let burnArtifact = $t04267542749._2
907865 $Tuple2(adjustedFee, burnArtifact)
908866 }
909867 else throw("Strict value is not equal to itself.")
910868 }
911869
912870
913871 func getArtifactId (i) = {
914872 let artifactId = if ((size(i.payments) > 1))
915873 then toBase58String(valueOrErrorMessage(i.payments[1].assetId, "Invalid artifactId"))
916874 else ""
917875 artifactId
918876 }
919877
920878
921879 func distributeFee (_feeAmount) = {
922880 let feeToStakers = muld(_feeAmount, feeToStakersPercent())
923881 let feeToVault = (_feeAmount - feeToStakers)
924882 $Tuple2(feeToStakers, feeToVault)
925883 }
926884
927885
928886 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, _feeToStakersPercent), IntegerEntry(k_rolloverFee, _rolloverFee), IntegerEntry(k_fundingMode, _fundingMode)]
929887
930888
931889 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)]
932890
933891
934-func incrementPositionSequenceNumber (_isNewPosition,_address) = if (_isNewPosition)
935- then {
936- let currentSequence = lastSequence()
937-[IntegerEntry(toCompositeKey(k_positionSequence, _address), (currentSequence + 1)), IntegerEntry(k_sequence, (currentSequence + 1))]
938- }
939- else nil
892+func incrementPositionSequenceNumber (_isNewPosition,_trader,_direction) = {
893+ let positionKey = ((_trader + "_") + toString(_direction))
894+ if (_isNewPosition)
895+ then {
896+ let currentSequence = lastSequence()
897+[IntegerEntry(toCompositeKey(k_positionSequence, positionKey), (currentSequence + 1)), IntegerEntry(k_sequence, (currentSequence + 1))]
898+ }
899+ else nil
900+ }
940901
941902
942-func updatePositionFee (_isNewPosition,_address,_fee) = if (_isNewPosition)
943- then [IntegerEntry(toCompositeKey(k_positionFee, _address), _fee)]
944- else nil
903+func updatePositionFee (_isNewPosition,_trader,_direction,_fee) = {
904+ let positionKey = ((_trader + "_") + toString(_direction))
905+ if (_isNewPosition)
906+ then [IntegerEntry(toCompositeKey(k_positionFee, positionKey), _fee)]
907+ else nil
908+ }
945909
946910
947-func updatePosition (_address,_size,_margin,_openNotional,_latestCumulativePremiumFraction,_latestTimestamp) = [IntegerEntry(toCompositeKey(k_positionSize, _address), _size), IntegerEntry(toCompositeKey(k_positionMargin, _address), _margin), IntegerEntry(toCompositeKey(k_positionOpenNotional, _address), _openNotional), IntegerEntry(toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _address), _latestCumulativePremiumFraction), IntegerEntry(toCompositeKey(k_positionLastUpdatedTimestamp, _address), _latestTimestamp)]
911+func updatePosition (_trader,_size,_margin,_openNotional,_latestCumulativePremiumFraction,_latestTimestamp) = {
912+ let direction = getDirection(_size)
913+ let positionKey = ((_trader + "_") + toString(direction))
914+[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+ }
948916
949917
950918 func updateAmmReserves (_qtAstR,_bsAstR) = [IntegerEntry(k_quoteAssetReserve, _qtAstR), IntegerEntry(k_baseAssetReserve, _bsAstR)]
951919
952920
953921 func updateAmmWeights (_qtAstW,_bsAstW) = [IntegerEntry(k_quoteAssetWeight, _qtAstW), IntegerEntry(k_baseAssetWeight, _bsAstW)]
954922
955923
956924 func updateAmm (_qtAstR,_bsAstR,_totalPositionSizeAfter,_openInterestNotional,_totalLongPositionSize,_totalShortPositionSize,_totalLongOpenNotional,_totalShortOpenNotional) = {
957925 let _qtAstW = qtAstW()
958926 let _bsAstW = bsAstW()
959927 if (((_totalLongPositionSize - _totalShortPositionSize) != _totalPositionSizeAfter))
960928 then throw(((((("Invalid AMM state data: " + toString(_totalLongPositionSize)) + " + ") + toString(_totalShortPositionSize)) + " != ") + toString(_totalPositionSizeAfter)))
961929 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)])
962930 }
963931
964932
965-func deletePosition (_address) = [DeleteEntry(toCompositeKey(k_positionSize, _address)), DeleteEntry(toCompositeKey(k_positionMargin, _address)), DeleteEntry(toCompositeKey(k_positionOpenNotional, _address)), DeleteEntry(toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _address)), DeleteEntry(toCompositeKey(k_positionAsset, _address)), DeleteEntry(toCompositeKey(k_positionFee, _address)), DeleteEntry(toCompositeKey(k_positionLastUpdatedTimestamp, _address))]
933+func deletePosition (_trader,_direction) = {
934+ let positionKey = ((_trader + "_") + toString(_direction))
935+[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+ }
966937
967938
968939 func withdraw (_address,_amount) = {
969940 let balance = assetBalance(this, quoteAsset())
970941 if ((_amount > balance))
971942 then throw(((("Unable to withdraw " + toString(_amount)) + " from contract balance ") + toString(balance)))
972943 else [ScriptTransfer(_address, _amount, quoteAsset())]
973944 }
974945
975946
976947 func updateBalance (i) = if ((0 > i))
977948 then throw("Balance")
978949 else [IntegerEntry(k_balance, i)]
979950
980951
981952 func transferFee (i) = [ScriptTransfer(stakingAddress(), i, quoteAsset())]
982953
983954
984955 func doBurnArtifact (_burnArtifact,i) = if (_burnArtifact)
985956 then [Burn(valueOrErrorMessage(i.payments[1].assetId, "Invalid artifact"), 1)]
986957 else nil
987958
988959
989960 @Callable(i)
990961 func pause () = if ((i.caller != adminAddress()))
991962 then throw("Invalid pause params")
992963 else [BooleanEntry(k_paused, true)]
993964
994965
995966
996967 @Callable(i)
997968 func unpause () = if ((i.caller != adminAddress()))
998969 then throw("Invalid unpause params")
999970 else [BooleanEntry(k_paused, false)]
1000971
1001972
1002973
1003974 @Callable(i)
1004975 func setCloseOnly () = if ((i.caller != adminAddress()))
1005976 then throw("Invalid setCloseOnly params")
1006977 else [BooleanEntry(k_closeOnly, true)]
1007978
1008979
1009980
1010981 @Callable(i)
1011982 func unsetCloseOnly () = if ((i.caller != adminAddress()))
1012983 then throw("Invalid unsetCloseOnly params")
1013984 else [BooleanEntry(k_closeOnly, false)]
1014985
1015986
1016987
1017988 @Callable(i)
1018989 func addLiquidity (_quoteAssetAmount) = if (if ((i.caller != adminAddress()))
1019990 then true
1020991 else (0 >= _quoteAssetAmount))
1021992 then throw("Invalid addLiquidity params")
1022993 else {
1023994 let _qtAstR = qtAstR()
1024995 let _bsAstR = bsAstR()
1025996 let _qtAstW = qtAstW()
1026997 let _bsAstW = bsAstW()
1027998 let price = divd(muld(_qtAstR, _qtAstW), muld(_bsAstR, _bsAstW))
1028999 let qtAstRAfter = (_qtAstR + _quoteAssetAmount)
10291000 let baseAssetAmountToAdd = (divd(muld(qtAstRAfter, _qtAstW), price) - _bsAstR)
10301001 let bsAstRAfter = (_bsAstR + baseAssetAmountToAdd)
1031- let $t05043150582 = getSyncTerminalPrice(getOraclePrice(), qtAstRAfter, bsAstRAfter)
1032- let newQuoteAssetWeight = $t05043150582._1
1033- let newBaseAssetWeight = $t05043150582._2
1034- let marginToVault = $t05043150582._3
1002+ let $t05100451155 = getSyncTerminalPrice(getOraclePrice(), qtAstRAfter, bsAstRAfter)
1003+ let newQuoteAssetWeight = $t05100451155._1
1004+ let newBaseAssetWeight = $t05100451155._2
1005+ let marginToVault = $t05100451155._3
10351006 let doExchangePnL = if ((marginToVault != 0))
10361007 then {
10371008 let doExchangePnL = invoke(vaultAddress(), "exchangeFreeAndLocked", [marginToVault], nil)
10381009 if ((doExchangePnL == doExchangePnL))
10391010 then nil
10401011 else throw("Strict value is not equal to itself.")
10411012 }
10421013 else nil
10431014 if ((doExchangePnL == doExchangePnL))
10441015 then (updateAmmReserves(qtAstRAfter, bsAstRAfter) ++ updateAmmWeights(newQuoteAssetWeight, newBaseAssetWeight))
10451016 else throw("Strict value is not equal to itself.")
10461017 }
10471018
10481019
10491020
10501021 @Callable(i)
10511022 func removeLiquidity (_quoteAssetAmount) = if (if ((i.caller != adminAddress()))
10521023 then true
10531024 else (_quoteAssetAmount >= 0))
10541025 then throw("Invalid removeLiquidity params")
10551026 else {
10561027 let _qtAstR = qtAstR()
10571028 let _bsAstR = bsAstR()
10581029 let _qtAstW = qtAstW()
10591030 let _bsAstW = bsAstW()
10601031 let price = divd(muld(_qtAstR, _qtAstW), muld(_bsAstR, _bsAstW))
10611032 let qtAstRAfter = (_qtAstR - _quoteAssetAmount)
10621033 let baseAssetAmountToRemove = abs((divd(muld(qtAstRAfter, _qtAstW), price) - _bsAstR))
10631034 let bsAstRAfter = (_bsAstR - baseAssetAmountToRemove)
1064- let $t05167851829 = getSyncTerminalPrice(getOraclePrice(), qtAstRAfter, bsAstRAfter)
1065- let newQuoteAssetWeight = $t05167851829._1
1066- let newBaseAssetWeight = $t05167851829._2
1067- let marginToVault = $t05167851829._3
1035+ let $t05225152402 = getSyncTerminalPrice(getOraclePrice(), qtAstRAfter, bsAstRAfter)
1036+ let newQuoteAssetWeight = $t05225152402._1
1037+ let newBaseAssetWeight = $t05225152402._2
1038+ let marginToVault = $t05225152402._3
10681039 let doExchangePnL = if ((marginToVault != 0))
10691040 then {
10701041 let doExchangePnL = invoke(vaultAddress(), "exchangeFreeAndLocked", [marginToVault], nil)
10711042 if ((doExchangePnL == doExchangePnL))
10721043 then nil
10731044 else throw("Strict value is not equal to itself.")
10741045 }
10751046 else nil
10761047 if ((doExchangePnL == doExchangePnL))
10771048 then (updateAmmReserves(qtAstRAfter, bsAstRAfter) ++ updateAmmWeights(newQuoteAssetWeight, newBaseAssetWeight))
10781049 else throw("Strict value is not equal to itself.")
10791050 }
10801051
10811052
10821053
10831054 @Callable(i)
10841055 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))
10851056 then true
10861057 else (0 >= _initMarginRatio))
10871058 then true
10881059 else (0 >= _mmr))
10891060 then true
10901061 else (0 >= _liquidationFeeRatio))
10911062 then true
10921063 else (0 >= _fee))
10931064 then true
10941065 else (0 >= _spreadLimit))
10951066 then true
10961067 else (0 >= _maxPriceImpact))
10971068 then true
10981069 else (0 >= _partialLiquidationRatio))
10991070 then true
11001071 else (0 >= _maxPriceSpread))
11011072 then true
11021073 else (0 >= _maxOpenNotional))
11031074 then true
11041075 else (0 >= _feeToStakersPercent))
11051076 then true
11061077 else (_feeToStakersPercent > DECIMAL_UNIT))
11071078 then true
11081079 else (0 >= _maxOracleDelay))
11091080 then true
11101081 else (0 >= _rolloverFee))
11111082 then true
11121083 else if ((_fundingMode != FUNDING_SYMMETRIC))
11131084 then (_fundingMode != FUNDING_ASYMMETRIC)
11141085 else false)
11151086 then true
11161087 else !(initialized()))
11171088 then true
11181089 else (i.caller != adminAddress()))
11191090 then throw("Invalid changeSettings params")
11201091 else updateSettings(_initMarginRatio, _mmr, _liquidationFeeRatio, _fundingPeriod, _fee, _spreadLimit, _maxPriceImpact, _partialLiquidationRatio, _maxPriceSpread, _maxOpenNotional, _feeToStakersPercent, _maxOracleDelay, _rolloverFee, _fundingMode)
11211092
11221093
11231094
11241095 @Callable(i)
11251096 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))
11261097 then true
11271098 else (0 >= _bsAstR))
11281099 then true
11291100 else (0 >= _fundingPeriod))
11301101 then true
11311102 else (0 >= _initMarginRatio))
11321103 then true
11331104 else (0 >= _mmr))
11341105 then true
11351106 else (0 >= _liquidationFeeRatio))
11361107 then true
11371108 else (0 >= _fee))
11381109 then true
11391110 else (0 >= _spreadLimit))
11401111 then true
11411112 else (0 >= _maxPriceImpact))
11421113 then true
11431114 else (0 >= _partialLiquidationRatio))
11441115 then true
11451116 else (0 >= _maxPriceSpread))
11461117 then true
11471118 else (0 >= _maxOpenNotional))
11481119 then true
11491120 else (0 >= _feeToStakersPercent))
11501121 then true
11511122 else (_feeToStakersPercent > DECIMAL_UNIT))
11521123 then true
11531124 else (0 >= _maxOracleDelay))
11541125 then true
11551126 else (0 >= _rolloverFee))
11561127 then true
11571128 else if ((_fundingMode != FUNDING_SYMMETRIC))
11581129 then (_fundingMode != FUNDING_ASYMMETRIC)
11591130 else false)
11601131 then true
11611132 else initialized())
11621133 then true
11631134 else (i.caller != this))
11641135 then throw("Invalid initialize parameters")
11651136 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)))])
11661137
11671138
11681139
11691140 @Callable(i)
11701141 func increasePosition (_direction,_leverage,_minBaseAssetAmount,_refLink) = {
11711142 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
11721143 if ((sync == sync))
11731144 then {
11741145 let ensureCalledOnce = invoke(this, "ensureCalledOnce", nil, nil)
11751146 if ((ensureCalledOnce == ensureCalledOnce))
11761147 then {
11771148 let _trader = getActualCaller(i)
11781149 let _rawAmount = i.payments[0].amount
11791150 let _assetId = i.payments[0].assetId
11801151 let _assetIdStr = toBase58String(value(_assetId))
11811152 let isQuoteAsset = (_assetId == quoteAsset())
1182- if (if (if (if (if (if (if (if (if (if ((_direction != DIR_LONG))
1153+ if (if (if (if (if (if (if (if (if ((_direction != DIR_LONG))
11831154 then (_direction != DIR_SHORT)
11841155 else false)
11851156 then true
11861157 else (0 >= _rawAmount))
11871158 then true
11881159 else !(initialized()))
11891160 then true
11901161 else !(isQuoteAsset))
1191- then true
1192- else !(isSameAssetOrNoPosition(_trader, _assetIdStr)))
11931162 then true
11941163 else !(requireMoreMarginRatio(divd(DECIMAL_UNIT, _leverage), initMarginRatio(), true)))
11951164 then true
11961165 else paused())
11971166 then true
11981167 else closeOnly())
11991168 then true
12001169 else isMarketClosed())
12011170 then throw("Invalid increasePosition parameters")
12021171 else {
1203- let $t05795358102 = getForTraderWithArtifact(_trader, getArtifactId(i))
1204- let adjustedFee = $t05795358102._1
1205- let burnArtifact = $t05795358102._2
1172+ let $t05847258621 = getForTraderWithArtifact(_trader, getArtifactId(i))
1173+ let adjustedFee = $t05847258621._1
1174+ let burnArtifact = $t05847258621._2
12061175 let _amount = divd(_rawAmount, (muld(adjustedFee, _leverage) + DECIMAL_UNIT))
12071176 let distributeFeeAmount = (_rawAmount - _amount)
12081177 let referrerFeeAny = invoke(referralAddress(), "acceptPaymentWithLink", [_trader, _refLink], [AttachedPayment(quoteAsset(), distributeFeeAmount)])
12091178 if ((referrerFeeAny == referrerFeeAny))
12101179 then {
12111180 let referrerFee = match referrerFeeAny {
12121181 case x: Int =>
12131182 x
12141183 case _ =>
12151184 throw("Invalid referrerFee")
12161185 }
12171186 let feeAmount = (distributeFeeAmount - referrerFee)
1218- let $t05859858766 = getPosition(_trader)
1219- let oldPositionSize = $t05859858766._1
1220- let oldPositionMargin = $t05859858766._2
1221- let oldPositionOpenNotional = $t05859858766._3
1222- let oldPositionLstUpdCPF = $t05859858766._4
1223- let oldPositionTimestamp = $t05859858766._5
1187+ let $t05911759297 = getPosition(_trader, _direction)
1188+ let oldPositionSize = $t05911759297._1
1189+ let oldPositionMargin = $t05911759297._2
1190+ let oldPositionOpenNotional = $t05911759297._3
1191+ let oldPositionLstUpdCPF = $t05911759297._4
1192+ let oldPositionTimestamp = $t05911759297._5
12241193 let isNewPosition = (oldPositionSize == 0)
12251194 let isSameDirection = if ((oldPositionSize > 0))
12261195 then (_direction == DIR_LONG)
12271196 else (_direction == DIR_SHORT)
12281197 let expandExisting = if (!(isNewPosition))
12291198 then isSameDirection
12301199 else false
12311200 let isAdd = (_direction == DIR_LONG)
1232- let $t05905562176 = if (if (isNewPosition)
1201+ let $t05958662719 = if (if (isNewPosition)
12331202 then true
12341203 else expandExisting)
12351204 then {
12361205 let openNotional = muld(_amount, _leverage)
1237- let $t05956459737 = swapInput(isAdd, openNotional)
1238- let amountBaseAssetBought = $t05956459737._1
1239- let quoteAssetReserveAfter = $t05956459737._2
1240- let baseAssetReserveAfter = $t05956459737._3
1241- let totalPositionSizeAfter = $t05956459737._4
1206+ let $t06009560268 = swapInput(isAdd, openNotional)
1207+ let amountBaseAssetBought = $t06009560268._1
1208+ let quoteAssetReserveAfter = $t06009560268._2
1209+ let baseAssetReserveAfter = $t06009560268._3
1210+ let totalPositionSizeAfter = $t06009560268._4
12421211 if (if ((_minBaseAssetAmount != 0))
12431212 then (_minBaseAssetAmount > abs(amountBaseAssetBought))
12441213 else false)
12451214 then throw(((("Limit error: " + toString(abs(amountBaseAssetBought))) + " < ") + toString(_minBaseAssetAmount)))
12461215 else {
12471216 let newPositionSize = (oldPositionSize + amountBaseAssetBought)
12481217 let totalLongOpenInterestAfter = (openInterestLong() + (if ((newPositionSize > 0))
12491218 then openNotional
12501219 else 0))
12511220 let totalShortOpenInterestAfter = (openInterestShort() + (if ((0 > newPositionSize))
12521221 then openNotional
12531222 else 0))
1254- let $t06028360558 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, _amount)
1255- let remainMargin = $t06028360558._1
1256- let x1 = $t06028360558._2
1257- let x2 = $t06028360558._3
1258- let rolloverFee = $t06028360558._4
1223+ let $t06081461089 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, _amount)
1224+ let remainMargin = $t06081461089._1
1225+ let x1 = $t06081461089._2
1226+ let x2 = $t06081461089._3
1227+ let rolloverFee = $t06081461089._4
12591228 if (!(requireNotOverSpreadLimit(quoteAssetReserveAfter, baseAssetReserveAfter)))
12601229 then throw("Over max spread limit")
12611230 else if (!(requireNotOverMaxOpenNotional(totalLongOpenInterestAfter, totalShortOpenInterestAfter)))
12621231 then throw("Over max open notional")
12631232 else $Tuple14(newPositionSize, remainMargin, (oldPositionOpenNotional + openNotional), latestCumulativePremiumFraction(newPositionSize), lastTimestamp(), baseAssetReserveAfter, quoteAssetReserveAfter, totalPositionSizeAfter, (openInterestNotional() + openNotional), (totalLongPositionSize() + (if ((newPositionSize > 0))
12641233 then abs(amountBaseAssetBought)
12651234 else 0)), (totalShortPositionSize() + (if ((0 > newPositionSize))
12661235 then abs(amountBaseAssetBought)
12671236 else 0)), totalLongOpenInterestAfter, totalShortOpenInterestAfter, rolloverFee)
12681237 }
12691238 }
12701239 else {
12711240 let openNotional = muld(_amount, _leverage)
1272- let $t06187661992 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT)
1273- let oldPositionNotional = $t06187661992._1
1274- let unrealizedPnl = $t06187661992._2
1241+ let $t06240762535 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), _direction, PNL_OPTION_SPOT)
1242+ let oldPositionNotional = $t06240762535._1
1243+ let unrealizedPnl = $t06240762535._2
12751244 if ((oldPositionNotional > openNotional))
12761245 then throw("Use decreasePosition to decrease position size")
12771246 else throw("Close position first")
12781247 }
1279- let newPositionSize = $t05905562176._1
1280- let newPositionRemainMargin = $t05905562176._2
1281- let newPositionOpenNotional = $t05905562176._3
1282- let newPositionLatestCPF = $t05905562176._4
1283- let newPositionTimestamp = $t05905562176._5
1284- let baseAssetReserveAfter = $t05905562176._6
1285- let quoteAssetReserveAfter = $t05905562176._7
1286- let totalPositionSizeAfter = $t05905562176._8
1287- let openInterestNotionalAfter = $t05905562176._9
1288- let totalLongAfter = $t05905562176._10
1289- let totalShortAfter = $t05905562176._11
1290- let totalLongOpenInterestAfter = $t05905562176._12
1291- let totalShortOpenInterestAfter = $t05905562176._13
1292- let rolloverFee = $t05905562176._14
1293- let $t06218262253 = distributeFee((feeAmount + rolloverFee))
1294- let feeToStakers = $t06218262253._1
1295- let feeToVault = $t06218262253._2
1248+ let newPositionSize = $t05958662719._1
1249+ let newPositionRemainMargin = $t05958662719._2
1250+ let newPositionOpenNotional = $t05958662719._3
1251+ let newPositionLatestCPF = $t05958662719._4
1252+ let newPositionTimestamp = $t05958662719._5
1253+ let baseAssetReserveAfter = $t05958662719._6
1254+ let quoteAssetReserveAfter = $t05958662719._7
1255+ let totalPositionSizeAfter = $t05958662719._8
1256+ let openInterestNotionalAfter = $t05958662719._9
1257+ let totalLongAfter = $t05958662719._10
1258+ let totalShortAfter = $t05958662719._11
1259+ let totalLongOpenInterestAfter = $t05958662719._12
1260+ let totalShortOpenInterestAfter = $t05958662719._13
1261+ let rolloverFee = $t05958662719._14
1262+ let $t06272562796 = distributeFee((feeAmount + rolloverFee))
1263+ let feeToStakers = $t06272562796._1
1264+ let feeToVault = $t06272562796._2
12961265 let stake = if ((_amount >= rolloverFee))
12971266 then invoke(vaultAddress(), "addLocked", nil, [AttachedPayment(quoteAsset(), (_amount - rolloverFee))])
12981267 else invoke(vaultAddress(), "withdrawLocked", [(rolloverFee - _amount)], nil)
12991268 if ((stake == stake))
13001269 then {
13011270 let depositVault = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)])
13021271 if ((depositVault == depositVault))
13031272 then {
13041273 let notifyFee = invoke(minerAddress(), "notifyFees", [_trader, feeAmount], nil)
13051274 if ((notifyFee == notifyFee))
13061275 then {
13071276 let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, newPositionOpenNotional], nil)
13081277 if ((notifyNotional == notifyNotional))
1309- then ((((((updatePosition(_trader, newPositionSize, newPositionRemainMargin, newPositionOpenNotional, newPositionLatestCPF, newPositionTimestamp) ++ incrementPositionSequenceNumber(isNewPosition, _trader)) ++ updatePositionFee(isNewPosition, _trader, adjustedFee)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)) ++ transferFee(feeToStakers)) ++ updateBalance(((cbalance() + _amount) - rolloverFee))) ++ doBurnArtifact(burnArtifact, i))
1278+ 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))
13101279 else throw("Strict value is not equal to itself.")
13111280 }
13121281 else throw("Strict value is not equal to itself.")
13131282 }
13141283 else throw("Strict value is not equal to itself.")
13151284 }
13161285 else throw("Strict value is not equal to itself.")
13171286 }
13181287 else throw("Strict value is not equal to itself.")
13191288 }
13201289 }
13211290 else throw("Strict value is not equal to itself.")
13221291 }
13231292 else throw("Strict value is not equal to itself.")
13241293 }
13251294
13261295
13271296
13281297 @Callable(i)
1329-func addMargin () = {
1298+func addMargin (_direction) = {
13301299 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
13311300 if ((sync == sync))
13321301 then {
13331302 let ensureCalledOnce = invoke(this, "ensureCalledOnce", nil, nil)
13341303 if ((ensureCalledOnce == ensureCalledOnce))
13351304 then {
13361305 let _trader = toString(i.caller)
13371306 let _amount = i.payments[0].amount
13381307 let _assetId = i.payments[0].assetId
13391308 let _assetIdStr = toBase58String(value(_assetId))
13401309 let isQuoteAsset = (_assetId == quoteAsset())
1341- if (if (if (if (if (if (if (!(isQuoteAsset))
1310+ if (if (if (if (if (!(isQuoteAsset))
13421311 then true
1343- else !(requireOpenPosition(toString(i.caller))))
1344- then true
1345- else !(isSameAsset(_trader, _assetIdStr)))
1312+ else !(requireOpenPosition(toString(i.caller), _direction)))
13461313 then true
13471314 else !(initialized()))
13481315 then true
13491316 else paused())
13501317 then true
1351- else closeOnly())
1352- then true
13531318 else isMarketClosed())
13541319 then throw("Invalid addMargin parameters")
13551320 else {
1356- let $t06451064678 = getPosition(_trader)
1357- let oldPositionSize = $t06451064678._1
1358- let oldPositionMargin = $t06451064678._2
1359- let oldPositionOpenNotional = $t06451064678._3
1360- let oldPositionLstUpdCPF = $t06451064678._4
1361- let oldPositionTimestamp = $t06451064678._5
1321+ let $t06504365223 = getPosition(_trader, _direction)
1322+ let oldPositionSize = $t06504365223._1
1323+ let oldPositionMargin = $t06504365223._2
1324+ let oldPositionOpenNotional = $t06504365223._3
1325+ let oldPositionLstUpdCPF = $t06504365223._4
1326+ let oldPositionTimestamp = $t06504365223._5
13621327 let stake = invoke(vaultAddress(), "addLocked", nil, [AttachedPayment(quoteAsset(), _amount)])
13631328 if ((stake == stake))
13641329 then {
13651330 let rolloverFee = calcRolloverFee(oldPositionMargin, oldPositionTimestamp)
13661331 let doTransferFeeToStakers = if ((rolloverFee > 0))
13671332 then {
1368- let $t06496365022 = distributeFee(rolloverFee)
1369- let feeToStakers = $t06496365022._1
1370- let feeToVault = $t06496365022._2
1333+ let $t06550865567 = distributeFee(rolloverFee)
1334+ let feeToStakers = $t06550865567._1
1335+ let feeToVault = $t06550865567._2
13711336 let unstake = invoke(vaultAddress(), "withdrawLocked", [feeToStakers], nil)
13721337 if ((unstake == unstake))
13731338 then {
13741339 let lockBadDebt = invoke(vaultAddress(), "exchangeFreeAndLocked", [-(feeToVault)], nil)
13751340 if ((lockBadDebt == lockBadDebt))
13761341 then transferFee(feeToStakers)
13771342 else throw("Strict value is not equal to itself.")
13781343 }
13791344 else throw("Strict value is not equal to itself.")
13801345 }
13811346 else nil
13821347 if ((doTransferFeeToStakers == doTransferFeeToStakers))
13831348 then ((updatePosition(_trader, oldPositionSize, ((oldPositionMargin - rolloverFee) + _amount), oldPositionOpenNotional, oldPositionLstUpdCPF, lastTimestamp()) ++ updateBalance(((cbalance() + _amount) - rolloverFee))) ++ doTransferFeeToStakers)
13841349 else throw("Strict value is not equal to itself.")
13851350 }
13861351 else throw("Strict value is not equal to itself.")
13871352 }
13881353 }
13891354 else throw("Strict value is not equal to itself.")
13901355 }
13911356 else throw("Strict value is not equal to itself.")
13921357 }
13931358
13941359
13951360
13961361 @Callable(i)
1397-func removeMargin (_amount) = {
1362+func removeMargin (_amount,_direction) = {
13981363 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
13991364 if ((sync == sync))
14001365 then {
14011366 let ensureCalledOnce = invoke(this, "ensureCalledOnce", nil, nil)
14021367 if ((ensureCalledOnce == ensureCalledOnce))
14031368 then {
14041369 let _trader = toString(i.caller)
14051370 if (if (if (if (if ((0 >= _amount))
14061371 then true
1407- else !(requireOpenPosition(_trader)))
1372+ else !(requireOpenPosition(_trader, _direction)))
14081373 then true
14091374 else !(initialized()))
14101375 then true
14111376 else paused())
14121377 then true
14131378 else isMarketClosed())
14141379 then throw("Invalid removeMargin parameters")
14151380 else {
1416- let $t06639566563 = getPosition(_trader)
1417- let oldPositionSize = $t06639566563._1
1418- let oldPositionMargin = $t06639566563._2
1419- let oldPositionOpenNotional = $t06639566563._3
1420- let oldPositionLstUpdCPF = $t06639566563._4
1421- let oldPositionTimestamp = $t06639566563._5
1422- let $t06656966818 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, -(_amount))
1423- let remainMargin = $t06656966818._1
1424- let badDebt = $t06656966818._2
1425- let fundingPayment = $t06656966818._3
1426- let rolloverFee = $t06656966818._4
1381+ let $t06697167151 = getPosition(_trader, _direction)
1382+ let oldPositionSize = $t06697167151._1
1383+ let oldPositionMargin = $t06697167151._2
1384+ let oldPositionOpenNotional = $t06697167151._3
1385+ let oldPositionLstUpdCPF = $t06697167151._4
1386+ let oldPositionTimestamp = $t06697167151._5
1387+ let $t06715767406 = calcRemainMarginWithFundingPaymentAndRolloverFee(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, oldPositionTimestamp, -(_amount))
1388+ let remainMargin = $t06715767406._1
1389+ let badDebt = $t06715767406._2
1390+ let fundingPayment = $t06715767406._3
1391+ let rolloverFee = $t06715767406._4
14271392 if ((badDebt != 0))
14281393 then throw("Invalid removed margin amount")
14291394 else {
14301395 let marginRatio = calcMarginRatio(remainMargin, badDebt, oldPositionOpenNotional)
14311396 if (!(requireMoreMarginRatio(marginRatio, initMarginRatio(), true)))
14321397 then throw(((("Too much margin removed: " + toString(marginRatio)) + " < ") + toString(initMarginRatio())))
14331398 else {
1434- let $t06720467263 = distributeFee(rolloverFee)
1435- let feeToStakers = $t06720467263._1
1436- let feeToVault = $t06720467263._2
1399+ let $t06779267851 = distributeFee(rolloverFee)
1400+ let feeToStakers = $t06779267851._1
1401+ let feeToVault = $t06779267851._2
14371402 let doTransferFeeToStakers = if ((rolloverFee > 0))
14381403 then {
14391404 let lockBadDebt = invoke(vaultAddress(), "exchangeFreeAndLocked", [-(feeToVault)], nil)
14401405 if ((lockBadDebt == lockBadDebt))
14411406 then transferFee(feeToStakers)
14421407 else throw("Strict value is not equal to itself.")
14431408 }
14441409 else nil
14451410 if ((doTransferFeeToStakers == doTransferFeeToStakers))
14461411 then {
14471412 let unstake = invoke(vaultAddress(), "withdrawLocked", [(_amount + feeToStakers)], nil)
14481413 if ((unstake == unstake))
14491414 then (((updatePosition(_trader, oldPositionSize, remainMargin, oldPositionOpenNotional, latestCumulativePremiumFraction(oldPositionSize), lastTimestamp()) ++ withdraw(i.caller, _amount)) ++ updateBalance(((cbalance() - _amount) - rolloverFee))) ++ doTransferFeeToStakers)
14501415 else throw("Strict value is not equal to itself.")
14511416 }
14521417 else throw("Strict value is not equal to itself.")
14531418 }
14541419 }
14551420 }
14561421 }
14571422 else throw("Strict value is not equal to itself.")
14581423 }
14591424 else throw("Strict value is not equal to itself.")
14601425 }
14611426
14621427
14631428
14641429 @Callable(i)
1465-func closePosition (_size,_minQuoteAssetAmount,_addToMargin) = {
1430+func closePosition (_size,_direction,_minQuoteAssetAmount,_addToMargin) = {
14661431 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
14671432 if ((sync == sync))
14681433 then {
14691434 let ensureCalledOnce = invoke(this, "ensureCalledOnce", nil, nil)
14701435 if ((ensureCalledOnce == ensureCalledOnce))
14711436 then {
14721437 let _trader = getActualCaller(i)
14731438 let _traderAddress = valueOrErrorMessage(addressFromString(_trader), "Invalid caller")
14741439 let positionFee = getPositionFee(_trader)
1475- if (if (if (if (if (if (!(requireOpenPosition(_trader)))
1440+ if (if (if (if (if (if (!(requireOpenPosition(_trader, _direction)))
14761441 then true
14771442 else !(initialized()))
14781443 then true
14791444 else paused())
14801445 then true
14811446 else (0 >= _size))
14821447 then true
14831448 else (0 > _minQuoteAssetAmount))
14841449 then true
14851450 else isMarketClosed())
14861451 then throw("Invalid closePosition parameters")
14871452 else {
1488- let oldPositionTimestamp = getPosition(_trader)._5
1489- let $t06943870023 = internalClosePosition(_trader, _size, positionFee, _minQuoteAssetAmount, _addToMargin, true, true)
1490- let newPositionSize = $t06943870023._1
1491- let newPositionMargin = $t06943870023._2
1492- let newPositionOpenNotional = $t06943870023._3
1493- let newPositionLstUpdCPF = $t06943870023._4
1494- let positionBadDebt = $t06943870023._5
1495- let realizedPnl = $t06943870023._6
1496- let marginToTrader = $t06943870023._7
1497- let quoteAssetReserveAfter = $t06943870023._8
1498- let baseAssetReserveAfter = $t06943870023._9
1499- let totalPositionSizeAfter = $t06943870023._10
1500- let openInterestNotionalAfter = $t06943870023._11
1501- let totalLongAfter = $t06943870023._12
1502- let totalShortAfter = $t06943870023._13
1503- let totalLongOpenInterestAfter = $t06943870023._14
1504- let totalShortOpenInterestAfter = $t06943870023._15
1505- let realizedFee = $t06943870023._16
1453+ let oldPositionTimestamp = getPosition(_trader, _direction)._5
1454+ let $t07006770670 = internalClosePosition(_trader, _direction, _size, positionFee, _minQuoteAssetAmount, _addToMargin, true, true)
1455+ let newPositionSize = $t07006770670._1
1456+ let newPositionMargin = $t07006770670._2
1457+ let newPositionOpenNotional = $t07006770670._3
1458+ let newPositionLstUpdCPF = $t07006770670._4
1459+ let positionBadDebt = $t07006770670._5
1460+ let realizedPnl = $t07006770670._6
1461+ let marginToTrader = $t07006770670._7
1462+ let quoteAssetReserveAfter = $t07006770670._8
1463+ let baseAssetReserveAfter = $t07006770670._9
1464+ let totalPositionSizeAfter = $t07006770670._10
1465+ let openInterestNotionalAfter = $t07006770670._11
1466+ let totalLongAfter = $t07006770670._12
1467+ let totalShortAfter = $t07006770670._13
1468+ let totalLongOpenInterestAfter = $t07006770670._14
1469+ let totalShortOpenInterestAfter = $t07006770670._15
1470+ let realizedFee = $t07006770670._16
15061471 if ((positionBadDebt > 0))
15071472 then throw("Invalid closePosition parameters: bad debt")
15081473 else if ((oldPositionTimestamp >= lastTimestamp()))
15091474 then throw("Invalid closePosition parameters: wait at least 1 block before closing the position")
15101475 else {
15111476 let isPartialClose = (newPositionSize != 0)
15121477 let withdrawAmount = (marginToTrader + realizedFee)
15131478 let ammBalance = (cbalance() - withdrawAmount)
15141479 let ammNewBalance = if ((0 > ammBalance))
15151480 then 0
15161481 else ammBalance
15171482 let unstake = invoke(vaultAddress(), "withdrawLocked", [withdrawAmount], nil)
15181483 if ((unstake == unstake))
15191484 then {
1520- let $t07069570754 = distributeFee(realizedFee)
1521- let feeToStakers = $t07069570754._1
1522- let feeToVault = $t07069570754._2
1523- let depositVault = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)])
1524- if ((depositVault == depositVault))
1485+ let referrerFeeAny = invoke(referralAddress(), "acceptPayment", [_trader], [AttachedPayment(quoteAsset(), realizedFee)])
1486+ if ((referrerFeeAny == referrerFeeAny))
15251487 then {
1526- let notifyFee = invoke(minerAddress(), "notifyFees", [_trader, realizedFee], nil)
1527- if ((notifyFee == notifyFee))
1488+ let referrerFee = match referrerFeeAny {
1489+ case x: Int =>
1490+ x
1491+ case _ =>
1492+ throw("Invalid referrerFee")
1493+ }
1494+ let $t07164271715 = distributeFee((realizedFee - referrerFee))
1495+ let feeToStakers = $t07164271715._1
1496+ let feeToVault = $t07164271715._2
1497+ let depositVault = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)])
1498+ if ((depositVault == depositVault))
15281499 then {
1529- let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, newPositionOpenNotional], nil)
1530- if ((notifyNotional == notifyNotional))
1531- then (((((if (isPartialClose)
1532- then updatePosition(_trader, newPositionSize, newPositionMargin, newPositionOpenNotional, newPositionLstUpdCPF, lastTimestamp())
1533- else deletePosition(_trader)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)) ++ (if ((marginToTrader > 0))
1534- then withdraw(_traderAddress, marginToTrader)
1535- else nil)) ++ updateBalance(ammNewBalance)) ++ transferFee(feeToStakers))
1500+ let notifyFee = invoke(minerAddress(), "notifyFees", [_trader, realizedFee], nil)
1501+ if ((notifyFee == notifyFee))
1502+ then {
1503+ let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, newPositionOpenNotional], nil)
1504+ if ((notifyNotional == notifyNotional))
1505+ then (((((if (isPartialClose)
1506+ then updatePosition(_trader, newPositionSize, newPositionMargin, newPositionOpenNotional, newPositionLstUpdCPF, lastTimestamp())
1507+ else deletePosition(_trader, _direction)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)) ++ (if ((marginToTrader > 0))
1508+ then withdraw(_traderAddress, marginToTrader)
1509+ else nil)) ++ updateBalance(ammNewBalance)) ++ transferFee(feeToStakers))
1510+ else throw("Strict value is not equal to itself.")
1511+ }
15361512 else throw("Strict value is not equal to itself.")
15371513 }
15381514 else throw("Strict value is not equal to itself.")
15391515 }
15401516 else throw("Strict value is not equal to itself.")
15411517 }
15421518 else throw("Strict value is not equal to itself.")
15431519 }
15441520 }
15451521 }
15461522 else throw("Strict value is not equal to itself.")
15471523 }
15481524 else throw("Strict value is not equal to itself.")
15491525 }
15501526
15511527
15521528
15531529 @Callable(i)
1554-func liquidate (_trader) = {
1530+func liquidate (_trader,_direction) = {
15551531 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
15561532 if ((sync == sync))
15571533 then {
1558- let spotMarginRatio = getMarginRatioByOption(_trader, PNL_OPTION_SPOT)
1534+ let spotMarginRatio = getMarginRatioByOption(_trader, _direction, PNL_OPTION_SPOT)
15591535 let liquidationMarginRatio = if (isOverFluctuationLimit())
15601536 then {
1561- let oracleMarginRatio = getMarginRatioByOption(_trader, PNL_OPTION_ORACLE)
1537+ let oracleMarginRatio = getMarginRatioByOption(_trader, _direction, PNL_OPTION_ORACLE)
15621538 vmax(spotMarginRatio, oracleMarginRatio)
15631539 }
15641540 else spotMarginRatio
15651541 if (if (if (if (if (!(requireMoreMarginRatio(liquidationMarginRatio, maintenanceMarginRatio(), false)))
15661542 then true
1567- else !(requireOpenPosition(_trader)))
1543+ else !(requireOpenPosition(_trader, _direction)))
15681544 then true
15691545 else !(initialized()))
15701546 then true
15711547 else paused())
15721548 then true
15731549 else isMarketClosed())
15741550 then throw("Unable to liquidate")
15751551 else {
15761552 let isPartialLiquidation = if (if ((spotMarginRatio > liquidationFeeRatio()))
15771553 then (partialLiquidationRatio() > 0)
15781554 else false)
15791555 then (DECIMAL_UNIT > partialLiquidationRatio())
15801556 else false
1581- let oldPositionSize = getPosition(_trader)._1
1557+ let oldPositionSize = getPosition(_trader, _direction)._1
15821558 let positionSizeAbs = abs(oldPositionSize)
1583- let $t07317573498 = if (isPartialLiquidation)
1559+ let $t07421374536 = if (isPartialLiquidation)
15841560 then {
15851561 let liquidationSize = getPartialLiquidationAmount(_trader, oldPositionSize)
15861562 let liquidationRatio = divd(abs(liquidationSize), positionSizeAbs)
15871563 $Tuple2(liquidationRatio, abs(liquidationSize))
15881564 }
15891565 else $Tuple2(0, positionSizeAbs)
1590- let liquidationRatio = $t07317573498._1
1591- let liquidationSize = $t07317573498._2
1592- let $t07350474142 = internalClosePosition(_trader, if (isPartialLiquidation)
1566+ let liquidationRatio = $t07421374536._1
1567+ let liquidationSize = $t07421374536._2
1568+ let $t07454275198 = internalClosePosition(_trader, _direction, if (isPartialLiquidation)
15931569 then liquidationSize
15941570 else positionSizeAbs, liquidationFeeRatio(), 0, true, false, true)
1595- let newPositionSize = $t07350474142._1
1596- let newPositionMargin = $t07350474142._2
1597- let newPositionOpenNotional = $t07350474142._3
1598- let newPositionLstUpdCPF = $t07350474142._4
1599- let positionBadDebt = $t07350474142._5
1600- let realizedPnl = $t07350474142._6
1601- let marginToTrader = $t07350474142._7
1602- let quoteAssetReserveAfter = $t07350474142._8
1603- let baseAssetReserveAfter = $t07350474142._9
1604- let totalPositionSizeAfter = $t07350474142._10
1605- let openInterestNotionalAfter = $t07350474142._11
1606- let totalLongAfter = $t07350474142._12
1607- let totalShortAfter = $t07350474142._13
1608- let totalLongOpenInterestAfter = $t07350474142._14
1609- let totalShortOpenInterestAfter = $t07350474142._15
1610- let liquidationPenalty = $t07350474142._16
1571+ let newPositionSize = $t07454275198._1
1572+ let newPositionMargin = $t07454275198._2
1573+ let newPositionOpenNotional = $t07454275198._3
1574+ let newPositionLstUpdCPF = $t07454275198._4
1575+ let positionBadDebt = $t07454275198._5
1576+ let realizedPnl = $t07454275198._6
1577+ let marginToTrader = $t07454275198._7
1578+ let quoteAssetReserveAfter = $t07454275198._8
1579+ let baseAssetReserveAfter = $t07454275198._9
1580+ let totalPositionSizeAfter = $t07454275198._10
1581+ let openInterestNotionalAfter = $t07454275198._11
1582+ let totalLongAfter = $t07454275198._12
1583+ let totalShortAfter = $t07454275198._13
1584+ let totalLongOpenInterestAfter = $t07454275198._14
1585+ let totalShortOpenInterestAfter = $t07454275198._15
1586+ let liquidationPenalty = $t07454275198._16
16111587 let feeToLiquidator = (liquidationPenalty / 2)
16121588 let feeToVault = (liquidationPenalty - feeToLiquidator)
16131589 let ammBalance = (cbalance() - liquidationPenalty)
16141590 let newAmmBalance = if ((0 > ammBalance))
16151591 then 0
16161592 else ammBalance
16171593 let lockBadDebt = if ((positionBadDebt > 0))
16181594 then {
16191595 let lockBadDebt = invoke(vaultAddress(), "exchangeFreeAndLocked", [(positionBadDebt + liquidationPenalty)], nil)
16201596 if ((lockBadDebt == lockBadDebt))
16211597 then nil
16221598 else throw("Strict value is not equal to itself.")
16231599 }
16241600 else nil
16251601 if ((lockBadDebt == lockBadDebt))
16261602 then {
16271603 let unstake = invoke(vaultAddress(), "withdrawLocked", [liquidationPenalty], nil)
16281604 if ((unstake == unstake))
16291605 then {
16301606 let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)])
16311607 if ((depositInsurance == depositInsurance))
16321608 then {
16331609 let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, newPositionOpenNotional], nil)
16341610 if ((notifyNotional == notifyNotional))
16351611 then ((((if (isPartialLiquidation)
16361612 then updatePosition(_trader, newPositionSize, newPositionMargin, newPositionOpenNotional, newPositionLstUpdCPF, lastTimestamp())
1637- else deletePosition(_trader)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)) ++ withdraw(i.caller, feeToLiquidator)) ++ updateBalance(newAmmBalance))
1613+ else deletePosition(_trader, _direction)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)) ++ withdraw(i.caller, feeToLiquidator)) ++ updateBalance(newAmmBalance))
16381614 else throw("Strict value is not equal to itself.")
16391615 }
16401616 else throw("Strict value is not equal to itself.")
16411617 }
16421618 else throw("Strict value is not equal to itself.")
16431619 }
16441620 else throw("Strict value is not equal to itself.")
16451621 }
16461622 }
16471623 else throw("Strict value is not equal to itself.")
16481624 }
16491625
16501626
16511627
16521628 @Callable(i)
16531629 func payFunding () = {
16541630 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
16551631 if ((sync == sync))
16561632 then {
16571633 let fundingBlockTimestamp = nextFundingBlockTimestamp()
16581634 if (if (if ((fundingBlockTimestamp > lastTimestamp()))
16591635 then true
16601636 else !(initialized()))
16611637 then true
16621638 else paused())
16631639 then throw(((("Invalid funding block timestamp: " + toString(lastTimestamp())) + " < ") + toString(fundingBlockTimestamp)))
16641640 else {
16651641 let underlyingPrice = getOraclePrice()
1666- let $t07625576333 = getFunding()
1667- let shortPremiumFraction = $t07625576333._1
1668- let longPremiumFraction = $t07625576333._2
1669- let premiumToVault = $t07625576333._3
1642+ let $t07732377401 = getFunding()
1643+ let shortPremiumFraction = $t07732377401._1
1644+ let longPremiumFraction = $t07732377401._2
1645+ let premiumToVault = $t07732377401._3
16701646 let doPayFundingToVault = if ((premiumToVault > 0))
16711647 then {
16721648 let doPayFundingToVault = invoke(vaultAddress(), "exchangeFreeAndLocked", [-(premiumToVault)], nil)
16731649 if ((doPayFundingToVault == doPayFundingToVault))
16741650 then nil
16751651 else throw("Strict value is not equal to itself.")
16761652 }
16771653 else nil
16781654 if ((doPayFundingToVault == doPayFundingToVault))
16791655 then updateFunding((fundingBlockTimestamp + fundingPeriodSeconds()), (latestLongCumulativePremiumFraction() + longPremiumFraction), (latestShortCumulativePremiumFraction() + shortPremiumFraction), divd(longPremiumFraction, underlyingPrice), divd(shortPremiumFraction, underlyingPrice))
16801656 else throw("Strict value is not equal to itself.")
16811657 }
16821658 }
16831659 else throw("Strict value is not equal to itself.")
16841660 }
16851661
16861662
16871663
16881664 @Callable(i)
16891665 func syncTerminalPriceToOracle () = {
16901666 let _qtAstR = qtAstR()
16911667 let _bsAstR = bsAstR()
1692- let $t07738477750 = getSyncTerminalPrice(getOraclePrice(), _qtAstR, _bsAstR)
1693- let newQuoteAssetWeight = $t07738477750._1
1694- let newBaseAssetWeight = $t07738477750._2
1695- let marginToVault = $t07738477750._3
1668+ let $t07845478820 = getSyncTerminalPrice(getOraclePrice(), _qtAstR, _bsAstR)
1669+ let newQuoteAssetWeight = $t07845478820._1
1670+ let newBaseAssetWeight = $t07845478820._2
1671+ let marginToVault = $t07845478820._3
16961672 let marginToVaultAdj = if (if ((0 > marginToVault))
16971673 then (abs(marginToVault) > cbalance())
16981674 else false)
16991675 then -(cbalance())
17001676 else marginToVault
17011677 let doExchangePnL = if ((marginToVaultAdj != 0))
17021678 then {
17031679 let doExchangePnL = invoke(vaultAddress(), "exchangeFreeAndLocked", [marginToVaultAdj], nil)
17041680 if ((doExchangePnL == doExchangePnL))
17051681 then nil
17061682 else throw("Strict value is not equal to itself.")
17071683 }
17081684 else nil
17091685 if ((doExchangePnL == doExchangePnL))
17101686 then (updateBalance((cbalance() + marginToVaultAdj)) ++ updateAmmWeights(newQuoteAssetWeight, newBaseAssetWeight))
17111687 else throw("Strict value is not equal to itself.")
17121688 }
17131689
17141690
17151691
17161692 @Callable(i)
17171693 func ensureCalledOnce () = if ((i.caller != this))
17181694 then throw("Invalid saveCurrentTxId parameters")
17191695 else {
1696+ let txId = toBase58String(i.transactionId)
17201697 let lastTx = valueOrElse(getString(this, k_lastTx), "")
1721- if ((lastTx != toBase58String(i.transactionId)))
1722- then [StringEntry(k_lastTx, lastTx)]
1698+ if ((lastTx != txId))
1699+ then [StringEntry(k_lastTx, txId)]
17231700 else throw("Can not call vAMM methods twice in one tx")
17241701 }
17251702
17261703
17271704
17281705 @Callable(i)
1729-func view_calcRemainMarginWithFundingPayment (_trader) = {
1706+func migratePosition (_trader) = {
1707+ let positionSizeOpt = getInteger(this, toCompositeKey(k_positionSize, _trader))
1708+ if (isDefined(positionSizeOpt))
1709+ then {
1710+ let pSize = getIntegerValue(this, toCompositeKey(k_positionSize, _trader))
1711+ let pMargin = getIntegerValue(this, toCompositeKey(k_positionMargin, _trader))
1712+ let pNotional = getIntegerValue(this, toCompositeKey(k_positionOpenNotional, _trader))
1713+ let pFraction = getIntegerValue(this, toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _trader))
1714+ let pTimestamp = getIntegerValue(this, toCompositeKey(k_positionLastUpdatedTimestamp, _trader))
1715+ let pFee = getIntegerValue(this, toCompositeKey(k_positionFee, _trader))
1716+ let pSequence = getIntegerValue(this, toCompositeKey(k_positionSequence, _trader))
1717+ let pDirection = getDirection(pSize)
1718+ let positionKey = ((_trader + "_") + toString(pDirection))
1719+[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)]
1720+ }
1721+ else throw(("Nothing to migrate for " + _trader))
1722+ }
1723+
1724+
1725+
1726+@Callable(i)
1727+func view_calcRemainMarginWithFundingPayment (_trader,_direction) = {
17301728 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
17311729 if ((sync == sync))
17321730 then {
1733- let $t07929979423 = getPosition(_trader)
1734- let positionSize = $t07929979423._1
1735- let positionMargin = $t07929979423._2
1736- let pon = $t07929979423._3
1737- let positionLstUpdCPF = $t07929979423._4
1738- let positionTimestamp = $t07929979423._5
1739- let $t07942679527 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1740- let positionNotional = $t07942679527._1
1741- let unrealizedPnl = $t07942679527._2
1742- let $t07953079754 = calcRemainMarginWithFundingPaymentAndRolloverFee(positionSize, positionMargin, positionLstUpdCPF, positionTimestamp, unrealizedPnl)
1743- let remainMargin = $t07953079754._1
1744- let badDebt = $t07953079754._2
1745- let fundingPayment = $t07953079754._3
1746- let rolloverFee = $t07953079754._4
1747- throw(((((((s(remainMargin) + s(fundingPayment)) + s(getMarginRatio(_trader))) + s(unrealizedPnl)) + s(badDebt)) + s(positionNotional)) + s(rolloverFee)))
1731+ let $t08243282568 = getPosition(_trader, _direction)
1732+ let positionSize = $t08243282568._1
1733+ let positionMargin = $t08243282568._2
1734+ let pon = $t08243282568._3
1735+ let positionLstUpdCPF = $t08243282568._4
1736+ let positionTimestamp = $t08243282568._5
1737+ let $t08257182684 = getPositionNotionalAndUnrealizedPnl(_trader, _direction, PNL_OPTION_SPOT)
1738+ let positionNotional = $t08257182684._1
1739+ let unrealizedPnl = $t08257182684._2
1740+ let $t08268782911 = calcRemainMarginWithFundingPaymentAndRolloverFee(positionSize, positionMargin, positionLstUpdCPF, positionTimestamp, unrealizedPnl)
1741+ let remainMargin = $t08268782911._1
1742+ let badDebt = $t08268782911._2
1743+ let fundingPayment = $t08268782911._3
1744+ let rolloverFee = $t08268782911._4
1745+ throw(((((((s(remainMargin) + s(fundingPayment)) + s(getMarginRatio(_trader, _direction))) + s(unrealizedPnl)) + s(badDebt)) + s(positionNotional)) + s(rolloverFee)))
17481746 }
17491747 else throw("Strict value is not equal to itself.")
17501748 }
17511749
17521750
17531751
17541752 @Callable(i)
17551753 func view_getPegAdjustCost (_price) = {
17561754 let _qtAstR = qtAstR()
17571755 let _bsAstR = bsAstR()
17581756 let result = getSyncTerminalPrice(_price, _qtAstR, _bsAstR)
17591757 throw(toString(result._3))
17601758 }
17611759
17621760
17631761
17641762 @Callable(i)
17651763 func view_getTerminalAmmPrice () = {
1766- let $t08047780558 = getTerminalAmmState()
1767- let terminalQuoteAssetReserve = $t08047780558._1
1768- let terminalBaseAssetReserve = $t08047780558._2
1764+ let $t08364683727 = getTerminalAmmState()
1765+ let terminalQuoteAssetReserve = $t08364683727._1
1766+ let terminalBaseAssetReserve = $t08364683727._2
17691767 let price = divd(muld(terminalQuoteAssetReserve, qtAstW()), muld(terminalBaseAssetReserve, bsAstW()))
17701768 throw(toString(price))
17711769 }
17721770
17731771
17741772
17751773 @Callable(i)
17761774 func view_getFunding () = {
1777- let underlyingPrice = getOraclePrice()
1778- let $t08106781145 = getFunding()
1779- let shortPremiumFraction = $t08106781145._1
1780- let longPremiumFraction = $t08106781145._2
1781- let premiumToVault = $t08106781145._3
1782- let longFunding = divd(longPremiumFraction, underlyingPrice)
1783- let shortFunding = divd(shortPremiumFraction, underlyingPrice)
1784- throw(((((s(longFunding) + s(shortFunding)) + s(getSpotPrice())) + s(getOraclePrice())) + s(premiumToVault)))
1775+ let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
1776+ if ((sync == sync))
1777+ then {
1778+ let underlyingPrice = getOraclePrice()
1779+ let $t08428684364 = getFunding()
1780+ let shortPremiumFraction = $t08428684364._1
1781+ let longPremiumFraction = $t08428684364._2
1782+ let premiumToVault = $t08428684364._3
1783+ let longFunding = divd(longPremiumFraction, underlyingPrice)
1784+ let shortFunding = divd(shortPremiumFraction, underlyingPrice)
1785+ throw(((((s(longFunding) + s(shortFunding)) + s(getSpotPrice())) + s(getOraclePrice())) + s(premiumToVault)))
1786+ }
1787+ else throw("Strict value is not equal to itself.")
17851788 }
17861789
17871790
17881791
17891792 @Callable(i)
17901793 func computeSpotPrice () = {
17911794 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
17921795 if ((sync == sync))
17931796 then {
17941797 let result = getSpotPrice()
17951798 $Tuple2(nil, result)
17961799 }
17971800 else throw("Strict value is not equal to itself.")
17981801 }
17991802
18001803
18011804
18021805 @Callable(i)
18031806 func computeFeeForTraderWithArtifact (_trader,_artifactId) = {
18041807 let result = getForTraderWithArtifact(_trader, _artifactId)
18051808 $Tuple2(nil, result)
18061809 }
18071810
18081811
18091812 @Verifier(tx)
18101813 func verify () = {
18111814 let coordinatorStr = getString(this, k_coordinatorAddress)
18121815 if (isDefined(coordinatorStr))
18131816 then {
18141817 let admin = getString(addressFromStringValue(value(coordinatorStr)), k_admin_address)
18151818 if (isDefined(admin))
18161819 then valueOrElse(getBoolean(addressFromStringValue(value(admin)), ((("status_" + toString(this)) + "_") + toBase58String(tx.id))), false)
18171820 else throw("unable to verify: admin not set in coordinator")
18181821 }
18191822 else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
18201823 }
18211824

github/deemru/w8io/026f985 
299.18 ms