tx · 72BxAk9GAmPTFa5un3Phvhn9zwwRXafxUWF5vSgkm9h1

3MzHu4SpHqDEEdGuXHrinGsc1KDcWH5DvNY:  -0.07500000 Waves

2022.12.12 16:48 [2357201] smart account 3MzHu4SpHqDEEdGuXHrinGsc1KDcWH5DvNY > SELF 0.00000000 Waves

{ "type": 13, "id": "72BxAk9GAmPTFa5un3Phvhn9zwwRXafxUWF5vSgkm9h1", "fee": 7500000, "feeAssetId": null, "timestamp": 1670852904762, "version": 2, "chainId": 84, "sender": "3MzHu4SpHqDEEdGuXHrinGsc1KDcWH5DvNY", "senderPublicKey": "7bR2UrhZFBmmHFg5wxSiyEXRBYjvQxNpku7Wnppww5GK", "proofs": [ "WevkcA8cMQDqJpjzn7xsebxNTUpV4X5PVTKQbj16axwGuTwb2xj3NBdFtw2Wvf6S1Mx7SjzCBEokFCQvRxgqZYp" ], "script": "base64:BgJ6CAISABIAEgASABIDCgEBEgMKAQESDgoMAQEBAQEBAQEBAQEBEhQKEgEBAQEBAQEICAgIAQEBAQEBARIFCgMBAQESBgoEAQEBCBIAEgMKAQESBAoCAQESAwoBCBIAEgASAwoBCBIDCgEBEgASABIDCgEIEgASBAoCCAjAAQAJa19vcmFfa2V5AglrX29yYV9rZXkAD2tfb3JhX2Jsb2NrX2tleQIPa19vcmFfYmxvY2tfa2V5AAVrX29yYQIFa19vcmEACWtfYmFsYW5jZQIJa19iYWxhbmNlAAprX3NlcXVlbmNlAgprX3NlcXVlbmNlAA5rX3Bvc2l0aW9uU2l6ZQIOa19wb3NpdGlvblNpemUAEGtfcG9zaXRpb25NYXJnaW4CEGtfcG9zaXRpb25NYXJnaW4AFmtfcG9zaXRpb25PcGVuTm90aW9uYWwCFmtfcG9zaXRpb25PcGVuTm90aW9uYWwALmtfcG9zaXRpb25MYXN0VXBkYXRlZEN1bXVsYXRpdmVQcmVtaXVtRnJhY3Rpb24CEmtfcG9zaXRpb25GcmFjdGlvbgASa19wb3NpdGlvblNlcXVlbmNlAhJrX3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ity": 0 } View: original | compacted Prev: 4B8PaWkwByVR6Db1kJVwNfuHiwaGKVByHvyhm8VVX5BY Next: none Diff:
OldNewDifferences
4848 let k_maxPriceSpread = "k_maxPriceSpread"
4949
5050 let k_maxOpenNotional = "k_maxOpenNotional"
51+
52+let k_feeToStakersPercent = "k_feeToStakersPercent"
53+
54+let k_maxOracleDelay = "k_maxOracleDelay"
5155
5256 let k_lastDataStr = "k_lastDataStr"
5357
359363
360364
361365 func lastSequence () = intOr(k_sequence, 0)
366+
367+
368+func feeToStakersPercent () = int(k_feeToStakersPercent)
369+
370+
371+func maxOracleDelay () = int(k_maxOracleDelay)
362372
363373
364374 func getActualCaller (i) = valueOrElse(getString(ordersAddress(), "k_sender"), toString(i.caller))
459469 let amountBaseAssetBought = if (_isAdd)
460470 then amountBaseAssetBoughtAbs
461471 else -(amountBaseAssetBoughtAbs)
462- let $t01665516818 = updateReserve(_isAdd, _quoteAssetAmount, amountBaseAssetBoughtAbs)
463- let quoteAssetReserveAfter1 = $t01665516818._1
464- let baseAssetReserveAfter1 = $t01665516818._2
465- let totalPositionSizeAfter1 = $t01665516818._3
472+ let $t01694617109 = updateReserve(_isAdd, _quoteAssetAmount, amountBaseAssetBoughtAbs)
473+ let quoteAssetReserveAfter1 = $t01694617109._1
474+ let baseAssetReserveAfter1 = $t01694617109._2
475+ let totalPositionSizeAfter1 = $t01694617109._3
466476 let priceBefore = divd(muld(_qtAstR, _qtAstW), muld(_bsAstR, _bsAstW))
467477 let marketPrice = divd(_quoteAssetAmount, amountBaseAssetBoughtAbs)
468478 let priceDiff = abs((priceBefore - marketPrice))
482492 }
483493 else 0
484494 let signedMargin = ((_marginDelta - fundingPayment) + _oldPositionMargin)
485- let $t01830518432 = if ((0 > signedMargin))
495+ let $t01859618723 = if ((0 > signedMargin))
486496 then $Tuple2(0, abs(signedMargin))
487497 else $Tuple2(abs(signedMargin), 0)
488- let remainMargin = $t01830518432._1
489- let badDebt = $t01830518432._2
498+ let remainMargin = $t01859618723._1
499+ let badDebt = $t01859618723._2
490500 $Tuple3(remainMargin, badDebt, fundingPayment)
491501 }
492502
503513 let quoteAssetAfter = toInt(bdivd(k, toBigInt(muld(baseAssetPoolAmountAfter, _baseAssetWeight))))
504514 let quoteAssetSold = abs((quoteAssetAfter - muld(_quoteAssetReserve, _quoteAssetWeight)))
505515 let maxPriceImpactValue = maxPriceImpact()
506- let $t01962019781 = updateReserve(!(_isAdd), quoteAssetSold, _baseAssetAmount)
507- let quoteAssetReserveAfter1 = $t01962019781._1
508- let baseAssetReserveAfter1 = $t01962019781._2
509- let totalPositionSizeAfter1 = $t01962019781._3
516+ let $t01991120072 = updateReserve(!(_isAdd), quoteAssetSold, _baseAssetAmount)
517+ let quoteAssetReserveAfter1 = $t01991120072._1
518+ let baseAssetReserveAfter1 = $t01991120072._2
519+ let totalPositionSizeAfter1 = $t01991120072._3
510520 let marketPrice = divd(quoteAssetSold, _baseAssetAmount)
511521 let priceDiff = abs((priceBefore - marketPrice))
512522 let priceImpact = (DECIMAL_UNIT - divd(priceBefore, (priceBefore + priceDiff)))
529539 func getOracleTwapPrice () = {
530540 let oracle = valueOrErrorMessage(addressFromString(getStringValue(this, k_ora)), "")
531541 let priceKey = getStringValue(this, k_ora_key)
532- let blockKey = getStringValue(this, k_ora_block_key)
533542 let lastValue = valueOrErrorMessage(getInteger(oracle, priceKey), ((("Can not get oracle price. Oracle: " + toString(oracle)) + " key: ") + priceKey))
534- lastValue
543+ let blockKey = valueOrElse(getString(this, k_ora_block_key), "")
544+ if ((blockKey != ""))
545+ then {
546+ let currentBlock = lastBlock.height
547+ let lastOracleBlock = valueOrErrorMessage(getInteger(oracle, k_ora_block_key), ((("Can not get oracle block. Oracle: " + toString(oracle)) + " key: ") + blockKey))
548+ if (((currentBlock - lastOracleBlock) > maxOracleDelay()))
549+ then throw(((("Oracle stale data. Last oracle block: " + toString(lastOracleBlock)) + " current block: ") + toString(currentBlock)))
550+ else lastValue
551+ }
552+ else lastValue
535553 }
536554
537555
538556 func requireNotOverSpreadLimit (_quoteAssetReserve,_baseAssetReserve) = {
539557 let oraclePrice = getOracleTwapPrice()
540- let priceAfter = divd(_quoteAssetReserve, _baseAssetReserve)
558+ let _qtAstW = qtAstW()
559+ let _bsAstW = bsAstW()
560+ let priceAfter = divd(muld(_quoteAssetReserve, _qtAstW), muld(_baseAssetReserve, _bsAstW))
541561 let averagePrice = divd((oraclePrice + priceAfter), (2 * DECIMAL_UNIT))
542562 let absPriceDiff = divd(abs((oraclePrice - priceAfter)), averagePrice)
543563 if ((absPriceDiff > maxPriceSpread()))
577597 let isShort = (0 > _positionSize)
578598 let positionNotional = if ((_option == PNL_OPTION_SPOT))
579599 then {
580- let $t02365523875 = swapOutputWithReserves(!(isShort), positionSizeAbs, false, _quoteAssetReserve, _quoteAssetWeight, _baseAssetReserve, _baseAssetWeight)
581- let outPositionNotional = $t02365523875._1
582- let x1 = $t02365523875._2
583- let x2 = $t02365523875._3
584- let x3 = $t02365523875._4
600+ let $t02423824458 = swapOutputWithReserves(!(isShort), positionSizeAbs, false, _quoteAssetReserve, _quoteAssetWeight, _baseAssetReserve, _baseAssetWeight)
601+ let outPositionNotional = $t02423824458._1
602+ let x1 = $t02423824458._2
603+ let x2 = $t02423824458._3
604+ let x3 = $t02423824458._4
585605 outPositionNotional
586606 }
587607 else muld(positionSizeAbs, getOracleTwapPrice())
602622
603623
604624 func getPositionNotionalAndUnrealizedPnl (_trader,_option) = {
605- let $t02530025428 = getPosition(_trader)
606- let positionSize = $t02530025428._1
607- let positionMargin = $t02530025428._2
608- let positionOpenNotional = $t02530025428._3
609- let positionLstUpdCPF = $t02530025428._4
625+ let $t02588326011 = getPosition(_trader)
626+ let positionSize = $t02588326011._1
627+ let positionMargin = $t02588326011._2
628+ let positionOpenNotional = $t02588326011._3
629+ let positionLstUpdCPF = $t02588326011._4
610630 getPositionNotionalAndUnrealizedPnlByValues(positionSize, positionOpenNotional, qtAstR(), qtAstW(), bsAstR(), bsAstW(), _option)
611631 }
612632
615635
616636
617637 func getMarginRatioByOption (_trader,_option) = {
618- let $t02594126052 = getPosition(_trader)
619- let positionSize = $t02594126052._1
620- let positionMargin = $t02594126052._2
621- let pon = $t02594126052._3
622- let positionLstUpdCPF = $t02594126052._4
623- let $t02605826151 = getPositionNotionalAndUnrealizedPnl(_trader, _option)
624- let positionNotional = $t02605826151._1
625- let unrealizedPnl = $t02605826151._2
626- let $t02615626322 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl)
627- let remainMargin = $t02615626322._1
628- let badDebt = $t02615626322._2
638+ let $t02652426635 = getPosition(_trader)
639+ let positionSize = $t02652426635._1
640+ let positionMargin = $t02652426635._2
641+ let pon = $t02652426635._3
642+ let positionLstUpdCPF = $t02652426635._4
643+ let $t02664126734 = getPositionNotionalAndUnrealizedPnl(_trader, _option)
644+ let positionNotional = $t02664126734._1
645+ let unrealizedPnl = $t02664126734._2
646+ let $t02673926905 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl)
647+ let remainMargin = $t02673926905._1
648+ let badDebt = $t02673926905._2
629649 calcMarginRatio(remainMargin, badDebt, positionNotional)
630650 }
631651
650670
651671
652672 func internalClosePosition (_trader,_checkMaxPriceImpact) = {
653- let $t02756227690 = getPosition(_trader)
654- let positionSize = $t02756227690._1
655- let positionMargin = $t02756227690._2
656- let positionOpenNotional = $t02756227690._3
657- let positionLstUpdCPF = $t02756227690._4
673+ let $t02814528273 = getPosition(_trader)
674+ let positionSize = $t02814528273._1
675+ let positionMargin = $t02814528273._2
676+ let positionOpenNotional = $t02814528273._3
677+ let positionLstUpdCPF = $t02814528273._4
658678 let unrealizedPnl = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)._2
659- let $t02778527953 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl)
660- let remainMargin = $t02778527953._1
661- let badDebt = $t02778527953._2
679+ let $t02836828536 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl)
680+ let remainMargin = $t02836828536._1
681+ let badDebt = $t02836828536._2
662682 let exchangedPositionSize = -(positionSize)
663683 let realizedPnl = unrealizedPnl
664684 let marginToVault = -(remainMargin)
665- let $t02808028354 = swapOutput((positionSize > 0), abs(positionSize), _checkMaxPriceImpact)
666- let exchangedQuoteAssetAmount = $t02808028354._1
667- let quoteAssetReserveAfter = $t02808028354._2
668- let baseAssetReserveAfter = $t02808028354._3
669- let totalPositionSizeAfter = $t02808028354._4
670- let totalLongAfter = $t02808028354._5
671- let totalShortAfter = $t02808028354._6
685+ let $t02866328937 = swapOutput((positionSize > 0), abs(positionSize), _checkMaxPriceImpact)
686+ let exchangedQuoteAssetAmount = $t02866328937._1
687+ let quoteAssetReserveAfter = $t02866328937._2
688+ let baseAssetReserveAfter = $t02866328937._3
689+ let totalPositionSizeAfter = $t02866328937._4
690+ let totalLongAfter = $t02866328937._5
691+ let totalShortAfter = $t02866328937._6
672692 let openInterestNotionalAfter = (openInterestNotional() - positionOpenNotional)
673693 $Tuple13(exchangedPositionSize, badDebt, realizedPnl, marginToVault, quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, exchangedQuoteAssetAmount, totalLongAfter, totalShortAfter, (openInterestLong() - (if ((positionSize > 0))
674694 then positionOpenNotional
721741 then $Tuple2(qtAstR(), bsAstR())
722742 else {
723743 let direction = (_positionSize > 0)
724- let $t03047730656 = swapOutput(direction, abs(_positionSize), false)
725- let currentNetMarketValue = $t03047730656._1
726- let terminalQuoteAssetReserve = $t03047730656._2
727- let terminalBaseAssetReserve = $t03047730656._3
744+ let $t03106031239 = swapOutput(direction, abs(_positionSize), false)
745+ let currentNetMarketValue = $t03106031239._1
746+ let terminalQuoteAssetReserve = $t03106031239._2
747+ let terminalBaseAssetReserve = $t03106031239._3
728748 $Tuple2(terminalQuoteAssetReserve, terminalBaseAssetReserve)
729749 }
730750 }
795815 func getAdjustedFee (_artifactId,_baseFeeDiscount) = {
796816 let baseFeeRaw = fee()
797817 let baseFee = muld(baseFeeRaw, _baseFeeDiscount)
798- let $t03375534250 = if ((_artifactId != ""))
818+ let $t03433834833 = if ((_artifactId != ""))
799819 then {
800820 let artifactKind = strA(nftManagerAddress(), toCompositeKey(k_token_type, _artifactId))
801821 if ((artifactKind == FEE_REDUCTION_TOKEN_TYPE))
807827 else throw("Invalid attached artifact")
808828 }
809829 else $Tuple2(baseFee, false)
810- let adjustedFee = $t03375534250._1
811- let burnArtifact = $t03375534250._2
830+ let adjustedFee = $t03433834833._1
831+ let burnArtifact = $t03433834833._2
812832 $Tuple2(adjustedFee, burnArtifact)
813833 }
814834
815835
816-func updateSettings (_initMarginRatio,_mmr,_liquidationFeeRatio,_fundingPeriod,_fee,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread,_maxOpenNotional) = [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)]
836+func isSameAssetOrNoPosition (_trader,_assetId) = {
837+ let oldPositionSize = getPosition(_trader)._1
838+ if ((oldPositionSize == 0))
839+ then true
840+ else (getPositionAsset(_trader) == _assetId)
841+ }
842+
843+
844+func isSameAsset (_trader,_assetId) = (getPositionAsset(_trader) == _assetId)
845+
846+
847+func getBorrowedByTraderInMarketKey (_amm,_assetId,_trader) = ((((((k_trader_market_asset_collateral + "_") + _amm) + "_") + _assetId) + "_") + _trader)
848+
849+
850+func getBorrowedByTrader (_trader) = {
851+ let positionAsset = getPositionAsset(_trader)
852+ if ((positionAsset == toBase58String(quoteAsset())))
853+ then $Tuple2(0, positionAsset)
854+ else {
855+ let key = getBorrowedByTraderInMarketKey(toString(this), positionAsset, _trader)
856+ let borrow = valueOrElse(getInteger(collateralAddress(), key), 0)
857+ $Tuple2(borrow, positionAsset)
858+ }
859+ }
860+
861+
862+func getForTraderWithArtifact (_trader,_artifactId) = {
863+ let doGetFeeDiscount = invoke(minerAddress(), "computeFeeDiscount", [_trader], nil)
864+ if ((doGetFeeDiscount == doGetFeeDiscount))
865+ then {
866+ let feeDiscount = match doGetFeeDiscount {
867+ case x: Int =>
868+ x
869+ case _ =>
870+ throw("Invalid computeFeeDiscount result")
871+ }
872+ let $t03606436138 = getAdjustedFee(_artifactId, feeDiscount)
873+ let adjustedFee = $t03606436138._1
874+ let burnArtifact = $t03606436138._2
875+ $Tuple2(adjustedFee, burnArtifact)
876+ }
877+ else throw("Strict value is not equal to itself.")
878+ }
879+
880+
881+func getArtifactId (i) = {
882+ let artifactId = if ((size(i.payments) > 1))
883+ then toBase58String(valueOrErrorMessage(i.payments[1].assetId, "Invalid artifactId"))
884+ else ""
885+ artifactId
886+ }
887+
888+
889+func distributeFee (_feeAmount) = {
890+ let feeToStakers = muld(_feeAmount, feeToStakersPercent())
891+ let feeToVault = (_feeAmount - feeToStakers)
892+ $Tuple2(feeToStakers, feeToVault)
893+ }
894+
895+
896+func updateSettings (_initMarginRatio,_mmr,_liquidationFeeRatio,_fundingPeriod,_fee,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread,_maxOpenNotional,_feeToStakersPercent,_maxOracleDelay) = [IntegerEntry(k_initMarginRatio, _initMarginRatio), IntegerEntry(k_maintenanceMarginRatio, _mmr), IntegerEntry(k_liquidationFeeRatio, _liquidationFeeRatio), IntegerEntry(k_fundingPeriod, _fundingPeriod), IntegerEntry(k_fee, _fee), IntegerEntry(k_spreadLimit, _spreadLimit), IntegerEntry(k_maxPriceImpact, _maxPriceImpact), IntegerEntry(k_partialLiquidationRatio, _partialLiquidationRatio), IntegerEntry(k_maxPriceSpread, _maxPriceSpread), IntegerEntry(k_maxOpenNotional, _maxOpenNotional), IntegerEntry(k_feeToStakersPercent, _feeToStakersPercent), IntegerEntry(k_maxOracleDelay, _feeToStakersPercent)]
817897
818898
819899 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)]
833913 func updatePosition (_address,_size,_margin,_openNotional,_latestCumulativePremiumFraction) = [IntegerEntry(toCompositeKey(k_positionSize, _address), _size), IntegerEntry(toCompositeKey(k_positionMargin, _address), _margin), IntegerEntry(toCompositeKey(k_positionOpenNotional, _address), _openNotional), IntegerEntry(toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _address), _latestCumulativePremiumFraction)]
834914
835915
836-func appendTwap (price) = {
916+func appendTwap (_price) = {
837917 let minuteId = ((lastBlock.timestamp / 1000) / 60)
838918 let previousMinuteId = valueOrElse(getInteger(this, k_lastMinuteId), 0)
839919 if ((previousMinuteId > minuteId))
845925 if ((minuteId > previousMinuteId))
846926 then {
847927 let prevCumulativePrice = valueOrElse(getInteger(this, ((k_twapDataLastCumulativePrice + "_") + toString(previousMinuteId))), 0)
848- let prevPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(previousMinuteId))), price)
928+ let prevPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(previousMinuteId))), _price)
849929 let lastCumulativePrice = (prevCumulativePrice + ((minuteId - lastMinuteId) * prevPrice))
850930 let list = pushToQueue(strToList(valueOrElse(getString(this, k_lastDataStr), "")), TWAP_INTERVAL, toString(minuteId))
851-[IntegerEntry(toCompositeKey(k_twapDataLastCumulativePrice, toString(minuteId)), lastCumulativePrice), IntegerEntry(toCompositeKey(k_twapDataLastPrice, toString(minuteId)), price), IntegerEntry(toCompositeKey(k_twapDataPreviousMinuteId, toString(minuteId)), previousMinuteId), IntegerEntry(k_lastMinuteId, minuteId), StringEntry(k_lastDataStr, listToStr(list))]
931+[IntegerEntry(toCompositeKey(k_twapDataLastCumulativePrice, toString(minuteId)), lastCumulativePrice), IntegerEntry(toCompositeKey(k_twapDataLastPrice, toString(minuteId)), _price), IntegerEntry(toCompositeKey(k_twapDataPreviousMinuteId, toString(minuteId)), previousMinuteId), IntegerEntry(k_lastMinuteId, minuteId), StringEntry(k_lastDataStr, listToStr(list))]
852932 }
853933 else {
854934 let twapDataPreviousMinuteId = valueOrElse(getInteger(this, toCompositeKey(k_twapDataPreviousMinuteId, toString(minuteId))), 0)
855935 let prevCumulativePrice = valueOrElse(getInteger(this, toCompositeKey(k_twapDataLastCumulativePrice, toString(twapDataPreviousMinuteId))), 0)
856- let prevPrice = valueOrElse(getInteger(this, toCompositeKey(k_twapDataLastPrice, toString(twapDataPreviousMinuteId))), price)
936+ let prevPrice = valueOrElse(getInteger(this, toCompositeKey(k_twapDataLastPrice, toString(twapDataPreviousMinuteId))), _price)
857937 let lastCumulativePrice = (prevCumulativePrice + ((minuteId - twapDataPreviousMinuteId) * prevPrice))
858-[IntegerEntry(toCompositeKey(k_twapDataLastCumulativePrice, toString(minuteId)), lastCumulativePrice), IntegerEntry(toCompositeKey(k_twapDataLastPrice, toString(minuteId)), price)]
938+[IntegerEntry(toCompositeKey(k_twapDataLastCumulativePrice, toString(minuteId)), lastCumulativePrice), IntegerEntry(toCompositeKey(k_twapDataLastPrice, toString(minuteId)), _price)]
859939 }
860940 }
861941 }
898978 func doBurnArtifact (_burnArtifact,i) = if (_burnArtifact)
899979 then [Burn(valueOrErrorMessage(i.payments[1].assetId, "Invalid artifact"), 1)]
900980 else nil
901-
902-
903-func isSameAssetOrNoPosition (_trader,_assetId) = {
904- let oldPositionSize = getPosition(_trader)._1
905- if ((oldPositionSize == 0))
906- then true
907- else (getPositionAsset(_trader) == _assetId)
908- }
909-
910-
911-func isSameAsset (_trader,_assetId) = (getPositionAsset(_trader) == _assetId)
912-
913-
914-func getBorrowedByTraderInMarketKey (_amm,_assetId,_trader) = ((((((k_trader_market_asset_collateral + "_") + _amm) + "_") + _assetId) + "_") + _trader)
915-
916-
917-func getBorrowedByTrader (_trader) = {
918- let positionAsset = getPositionAsset(_trader)
919- if ((positionAsset == toBase58String(quoteAsset())))
920- then $Tuple2(0, positionAsset)
921- else {
922- let key = getBorrowedByTraderInMarketKey(toString(this), positionAsset, _trader)
923- let borrow = valueOrElse(getInteger(collateralAddress(), key), 0)
924- $Tuple2(borrow, positionAsset)
925- }
926- }
927-
928-
929-func getForTraderWithArtifact (_trader,_artifactId) = {
930- let doGetFeeDiscount = invoke(minerAddress(), "computeFeeDiscount", [_trader], nil)
931- if ((doGetFeeDiscount == doGetFeeDiscount))
932- then {
933- let feeDiscount = match doGetFeeDiscount {
934- case x: Int =>
935- x
936- case _ =>
937- throw("Invalid computeFeeDiscount result")
938- }
939- let $t04258342657 = getAdjustedFee(_artifactId, feeDiscount)
940- let adjustedFee = $t04258342657._1
941- let burnArtifact = $t04258342657._2
942- $Tuple2(adjustedFee, burnArtifact)
943- }
944- else throw("Strict value is not equal to itself.")
945- }
946-
947-
948-func getArtifactId (i) = {
949- let artifactId = if ((size(i.payments) > 1))
950- then toBase58String(valueOrErrorMessage(i.payments[1].assetId, "Invalid artifactId"))
951- else ""
952- artifactId
953- }
954981
955982
956983 @Callable(i)
10201047
10211048
10221049 @Callable(i)
1023-func changeSettings (_initMarginRatio,_mmr,_liquidationFeeRatio,_fundingPeriod,_fee,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread,_maxOpenNotional) = if ((i.caller != adminAddress()))
1050+func changeSettings (_initMarginRatio,_mmr,_liquidationFeeRatio,_fundingPeriod,_fee,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread,_maxOpenNotional,_feeToStakersPercent,_maxOracleDelay) = if ((i.caller != adminAddress()))
10241051 then throw("Invalid changeSettings params")
1025- else updateSettings(_initMarginRatio, _mmr, _liquidationFeeRatio, _fundingPeriod, _fee, _spreadLimit, _maxPriceImpact, _partialLiquidationRatio, _maxPriceSpread, _maxOpenNotional)
1026-
1027-
1028-
1029-@Callable(i)
1030-func initialize (_qtAstR,_bsAstR,_fundingPeriod,_initMarginRatio,_mmr,_liquidationFeeRatio,_fee,_oracle,_oracleKey,_coordinator,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread,_maxOpenNotional) = if (if (if (if (if (if (if (if (if (if (if (if (if ((0 >= _qtAstR))
1052+ else updateSettings(_initMarginRatio, _mmr, _liquidationFeeRatio, _fundingPeriod, _fee, _spreadLimit, _maxPriceImpact, _partialLiquidationRatio, _maxPriceSpread, _maxOpenNotional, _feeToStakersPercent, _maxOracleDelay)
1053+
1054+
1055+
1056+@Callable(i)
1057+func initialize (_qtAstR,_bsAstR,_fundingPeriod,_initMarginRatio,_mmr,_liquidationFeeRatio,_fee,_oracle,_oracleKey,_oracleBlockKey,_coordinator,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread,_maxOpenNotional,_feeToStakersPercent,_maxOracleDelay) = if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if ((0 >= _qtAstR))
10311058 then true
10321059 else (0 >= _bsAstR))
10331060 then true
10511078 then true
10521079 else (0 >= _maxOpenNotional))
10531080 then true
1081+ else (0 >= _feeToStakersPercent))
1082+ then true
1083+ else (_feeToStakersPercent > DECIMAL_UNIT))
1084+ then true
1085+ else (0 >= _maxOracleDelay))
1086+ then true
10541087 else initialized())
10551088 then throw("Invalid initialize parameters")
1056- else ((((updateAmm(_qtAstR, _bsAstR, 0, 0, 0, 0, 0, 0) ++ updateSettings(_initMarginRatio, _mmr, _liquidationFeeRatio, _fundingPeriod, _fee, _spreadLimit, _maxPriceImpact, _partialLiquidationRatio, _maxPriceSpread, _maxOpenNotional)) ++ updateFunding((lastBlock.timestamp + _fundingPeriod), 0, 0, 0, 0)) ++ updateBalance(0)) ++ [BooleanEntry(k_initialized, true), StringEntry(k_ora, _oracle), StringEntry(k_ora_key, _oracleKey), StringEntry(k_coordinatorAddress, _coordinator)])
1089+ else ((((updateAmm(_qtAstR, _bsAstR, 0, 0, 0, 0, 0, 0) ++ updateSettings(_initMarginRatio, _mmr, _liquidationFeeRatio, _fundingPeriod, _fee, _spreadLimit, _maxPriceImpact, _partialLiquidationRatio, _maxPriceSpread, _maxOpenNotional, _feeToStakersPercent, _maxOracleDelay)) ++ updateFunding((lastBlock.timestamp + _fundingPeriod), 0, 0, 0, 0)) ++ updateBalance(0)) ++ [BooleanEntry(k_initialized, true), StringEntry(k_ora, _oracle), StringEntry(k_ora_key, _oracleKey), StringEntry(k_ora_block_key, _oracleBlockKey), StringEntry(k_coordinatorAddress, _coordinator)])
10571090
10581091
10591092
10741107 else paused())
10751108 then throw("Invalid decreasePosition parameters")
10761109 else {
1077- let $t04734747487 = getPosition(_trader)
1078- let oldPositionSize = $t04734747487._1
1079- let oldPositionMargin = $t04734747487._2
1080- let oldPositionOpenNotional = $t04734747487._3
1081- let oldPositionLstUpdCPF = $t04734747487._4
1110+ let $t04867748817 = getPosition(_trader)
1111+ let oldPositionSize = $t04867748817._1
1112+ let oldPositionMargin = $t04867748817._2
1113+ let oldPositionOpenNotional = $t04867748817._3
1114+ let oldPositionLstUpdCPF = $t04867748817._4
10821115 let _direction = if ((oldPositionSize > 0))
10831116 then DIR_SHORT
10841117 else DIR_LONG
10851118 let isAdd = (_direction == DIR_LONG)
10861119 let openNotional = muld(_amount, _leverage)
1087- let $t04766047764 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1088- let oldPositionNotional = $t04766047764._1
1089- let unrealizedPnl = $t04766047764._2
1090- let $t04777050428 = if ((oldPositionNotional > openNotional))
1120+ let $t04899049094 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1121+ let oldPositionNotional = $t04899049094._1
1122+ let unrealizedPnl = $t04899049094._2
1123+ let $t04910051758 = if ((oldPositionNotional > openNotional))
10911124 then {
1092- let $t04818548369 = swapInput(isAdd, openNotional)
1093- let exchangedPositionSize = $t04818548369._1
1094- let quoteAssetReserveAfter = $t04818548369._2
1095- let baseAssetReserveAfter = $t04818548369._3
1096- let totalPositionSizeAfter = $t04818548369._4
1125+ let $t04951549699 = swapInput(isAdd, openNotional)
1126+ let exchangedPositionSize = $t04951549699._1
1127+ let quoteAssetReserveAfter = $t04951549699._2
1128+ let baseAssetReserveAfter = $t04951549699._3
1129+ let totalPositionSizeAfter = $t04951549699._4
10971130 let exchangedPositionSizeAbs = abs(exchangedPositionSize)
10981131 if (if ((_minBaseAssetAmount != 0))
10991132 then (_minBaseAssetAmount > exchangedPositionSizeAbs)
11011134 then throw(((("Too little base asset exchanged, got " + toString(exchangedPositionSizeAbs)) + " expected ") + toString(_minBaseAssetAmount)))
11021135 else {
11031136 let realizedPnl = divd(muld(unrealizedPnl, exchangedPositionSizeAbs), abs(oldPositionSize))
1104- let $t04880649051 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl)
1105- let remainMargin = $t04880649051._1
1106- let badDebt = $t04880649051._2
1107- let fundingPayment = $t04880649051._3
1137+ let $t05013650381 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl)
1138+ let remainMargin = $t05013650381._1
1139+ let badDebt = $t05013650381._2
1140+ let fundingPayment = $t05013650381._3
11081141 let exchangedQuoteAssetAmount = openNotional
11091142 let unrealizedPnlAfter = (unrealizedPnl - realizedPnl)
11101143 let remainOpenNotional = if ((oldPositionSize > 0))
11231156 }
11241157 }
11251158 else throw("Close position first")
1126- let newPositionSize = $t04777050428._1
1127- let newPositionRemainMargin = $t04777050428._2
1128- let newPositionOpenNotional = $t04777050428._3
1129- let newPositionLatestCPF = $t04777050428._4
1130- let baseAssetReserveAfter = $t04777050428._5
1131- let quoteAssetReserveAfter = $t04777050428._6
1132- let totalPositionSizeAfter = $t04777050428._7
1133- let openInterestNotionalAfter = $t04777050428._8
1134- let totalLongAfter = $t04777050428._9
1135- let totalShortAfter = $t04777050428._10
1136- let totalLongOpenInterestAfter = $t04777050428._11
1137- let totalShortOpenInterestAfter = $t04777050428._12
1159+ let newPositionSize = $t04910051758._1
1160+ let newPositionRemainMargin = $t04910051758._2
1161+ let newPositionOpenNotional = $t04910051758._3
1162+ let newPositionLatestCPF = $t04910051758._4
1163+ let baseAssetReserveAfter = $t04910051758._5
1164+ let quoteAssetReserveAfter = $t04910051758._6
1165+ let totalPositionSizeAfter = $t04910051758._7
1166+ let openInterestNotionalAfter = $t04910051758._8
1167+ let totalLongAfter = $t04910051758._9
1168+ let totalShortAfter = $t04910051758._10
1169+ let totalLongOpenInterestAfter = $t04910051758._11
1170+ let totalShortOpenInterestAfter = $t04910051758._12
11381171 let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, newPositionOpenNotional], nil)
11391172 if ((notifyNotional == notifyNotional))
11401173 then (updatePosition(_trader, newPositionSize, newPositionRemainMargin, newPositionOpenNotional, newPositionLatestCPF) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter))
11781211 else closeOnly())
11791212 then throw("Invalid increasePosition parameters")
11801213 else {
1181- let $t05186651951 = getForTraderWithArtifact(_trader, getArtifactId(i))
1182- let adjustedFee = $t05186651951._1
1183- let burnArtifact = $t05186651951._2
1214+ let $t05319653281 = getForTraderWithArtifact(_trader, getArtifactId(i))
1215+ let adjustedFee = $t05319653281._1
1216+ let burnArtifact = $t05319653281._2
11841217 let rawFeeAmount = muld(_rawAmount, adjustedFee)
11851218 let _amount = (_rawAmount - rawFeeAmount)
11861219 let distributeFeeAmount = if (isCollateralAsset)
12231256 throw("Invalid referrerFee")
12241257 }
12251258 let feeAmount = (distributeFeeAmount - referrerFee)
1226- let $t05326753407 = getPosition(_trader)
1227- let oldPositionSize = $t05326753407._1
1228- let oldPositionMargin = $t05326753407._2
1229- let oldPositionOpenNotional = $t05326753407._3
1230- let oldPositionLstUpdCPF = $t05326753407._4
1259+ let $t05459754737 = getPosition(_trader)
1260+ let oldPositionSize = $t05459754737._1
1261+ let oldPositionMargin = $t05459754737._2
1262+ let oldPositionOpenNotional = $t05459754737._3
1263+ let oldPositionLstUpdCPF = $t05459754737._4
12311264 let isNewPosition = (oldPositionSize == 0)
12321265 let isSameDirection = if ((oldPositionSize > 0))
12331266 then (_direction == DIR_LONG)
12361269 then isSameDirection
12371270 else false
12381271 let isAdd = (_direction == DIR_LONG)
1239- let $t05369656737 = if (if (isNewPosition)
1272+ let $t05502658067 = if (if (isNewPosition)
12401273 then true
12411274 else expandExisting)
12421275 then {
12431276 let openNotional = muld(_amount, _leverage)
1244- let $t05415854331 = swapInput(isAdd, openNotional)
1245- let amountBaseAssetBought = $t05415854331._1
1246- let quoteAssetReserveAfter = $t05415854331._2
1247- let baseAssetReserveAfter = $t05415854331._3
1248- let totalPositionSizeAfter = $t05415854331._4
1277+ let $t05548855661 = swapInput(isAdd, openNotional)
1278+ let amountBaseAssetBought = $t05548855661._1
1279+ let quoteAssetReserveAfter = $t05548855661._2
1280+ let baseAssetReserveAfter = $t05548855661._3
1281+ let totalPositionSizeAfter = $t05548855661._4
12491282 if (if ((_minBaseAssetAmount != 0))
12501283 then (_minBaseAssetAmount > abs(amountBaseAssetBought))
12511284 else false)
12591292 then openNotional
12601293 else 0))
12611294 let increaseMarginRequirement = divd(openNotional, _leverage)
1262- let $t05493955178 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, increaseMarginRequirement)
1263- let remainMargin = $t05493955178._1
1264- let x1 = $t05493955178._2
1265- let x2 = $t05493955178._3
1295+ let $t05626956508 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, increaseMarginRequirement)
1296+ let remainMargin = $t05626956508._1
1297+ let x1 = $t05626956508._2
1298+ let x2 = $t05626956508._3
12661299 if (!(requireNotOverSpreadLimit(quoteAssetReserveAfter, baseAssetReserveAfter)))
12671300 then throw("Over max spread limit")
12681301 else if (!(requireNotOverMaxOpenNotional(totalLongOpenInterestAfter, totalShortOpenInterestAfter)))
12761309 }
12771310 else {
12781311 let openNotional = muld(_amount, _leverage)
1279- let $t05643756553 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT)
1280- let oldPositionNotional = $t05643756553._1
1281- let unrealizedPnl = $t05643756553._2
1312+ let $t05776757883 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT)
1313+ let oldPositionNotional = $t05776757883._1
1314+ let unrealizedPnl = $t05776757883._2
12821315 if ((oldPositionNotional > openNotional))
12831316 then throw("Use decreasePosition to decrease position size")
12841317 else throw("Close position first")
12851318 }
1286- let newPositionSize = $t05369656737._1
1287- let newPositionRemainMargin = $t05369656737._2
1288- let newPositionOpenNotional = $t05369656737._3
1289- let newPositionLatestCPF = $t05369656737._4
1290- let baseAssetReserveAfter = $t05369656737._5
1291- let quoteAssetReserveAfter = $t05369656737._6
1292- let totalPositionSizeAfter = $t05369656737._7
1293- let openInterestNotionalAfter = $t05369656737._8
1294- let totalLongAfter = $t05369656737._9
1295- let totalShortAfter = $t05369656737._10
1296- let totalLongOpenInterestAfter = $t05369656737._11
1297- let totalShortOpenInterestAfter = $t05369656737._12
1298- let feeToStakers = (feeAmount / 2)
1299- let feeToInsurance = (feeAmount - feeToStakers)
1300- let stake = invoke(vaultAddress(), "addLocked", nil, [AttachedPayment(quoteAsset(), _amount)])
1319+ let newPositionSize = $t05502658067._1
1320+ let newPositionRemainMargin = $t05502658067._2
1321+ let newPositionOpenNotional = $t05502658067._3
1322+ let newPositionLatestCPF = $t05502658067._4
1323+ let baseAssetReserveAfter = $t05502658067._5
1324+ let quoteAssetReserveAfter = $t05502658067._6
1325+ let totalPositionSizeAfter = $t05502658067._7
1326+ let openInterestNotionalAfter = $t05502658067._8
1327+ let totalLongAfter = $t05502658067._9
1328+ let totalShortAfter = $t05502658067._10
1329+ let totalLongOpenInterestAfter = $t05502658067._11
1330+ let totalShortOpenInterestAfter = $t05502658067._12
1331+ let $t05807358130 = distributeFee(feeAmount)
1332+ let feeToStakers = $t05807358130._1
1333+ let feeToVault = $t05807358130._2
1334+ let stake = if (isQuoteAsset)
1335+ then {
1336+ let stake = invoke(vaultAddress(), "addLocked", [false], [AttachedPayment(quoteAsset(), _amount)])
1337+ if ((stake == stake))
1338+ then nil
1339+ else throw("Strict value is not equal to itself.")
1340+ }
1341+ else nil
13011342 if ((stake == stake))
13021343 then {
1303- let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToInsurance)])
1344+ let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)])
13041345 if ((depositInsurance == depositInsurance))
13051346 then {
13061347 let notifyFee = invoke(minerAddress(), "notifyFees", [_trader, feeAmount], nil)
13531394 else closeOnly())
13541395 then throw("Invalid addMargin parameters")
13551396 else {
1356- let $t05867958764 = getForTraderWithArtifact(_trader, getArtifactId(i))
1357- let adjustedFee = $t05867958764._1
1358- let burnArtifact = $t05867958764._2
1397+ let $t06007860163 = getForTraderWithArtifact(_trader, getArtifactId(i))
1398+ let adjustedFee = $t06007860163._1
1399+ let burnArtifact = $t06007860163._2
13591400 let rawFeeAmount = muld(_rawAmount, adjustedFee)
13601401 let _amount = (_rawAmount - rawFeeAmount)
13611402 let distributeFeeAmount = if (isCollateralAsset)
13981439 throw("Invalid referrerFee")
13991440 }
14001441 let feeAmount = (distributeFeeAmount - referrerFee)
1401- let $t06006360203 = getPosition(_trader)
1402- let oldPositionSize = $t06006360203._1
1403- let oldPositionMargin = $t06006360203._2
1404- let oldPositionOpenNotional = $t06006360203._3
1405- let oldPositionLstUpdCPF = $t06006360203._4
1406- let feeToStakers = (feeAmount / 2)
1407- let feeToInsurance = (feeAmount - feeToStakers)
1408- let stake = invoke(vaultAddress(), "addLocked", nil, [AttachedPayment(quoteAsset(), _amount)])
1442+ let $t06146261602 = getPosition(_trader)
1443+ let oldPositionSize = $t06146261602._1
1444+ let oldPositionMargin = $t06146261602._2
1445+ let oldPositionOpenNotional = $t06146261602._3
1446+ let oldPositionLstUpdCPF = $t06146261602._4
1447+ let $t06160861665 = distributeFee(feeAmount)
1448+ let feeToStakers = $t06160861665._1
1449+ let feeToVault = $t06160861665._2
1450+ let stake = if (isQuoteAsset)
1451+ then {
1452+ let stake = invoke(vaultAddress(), "addLocked", [false], [AttachedPayment(quoteAsset(), _amount)])
1453+ if ((stake == stake))
1454+ then nil
1455+ else throw("Strict value is not equal to itself.")
1456+ }
1457+ else nil
14091458 if ((stake == stake))
14101459 then {
1411- let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToInsurance)])
1460+ let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)])
14121461 if ((depositInsurance == depositInsurance))
14131462 then {
14141463 let notifyFee = invoke(minerAddress(), "notifyFees", [_trader, feeAmount], nil)
14451494 else paused())
14461495 then throw("Invalid removeMargin parameters")
14471496 else {
1448- let $t06130961449 = getPosition(_trader)
1449- let oldPositionSize = $t06130961449._1
1450- let oldPositionMargin = $t06130961449._2
1451- let oldPositionOpenNotional = $t06130961449._3
1452- let oldPositionLstUpdCPF = $t06130961449._4
1497+ let $t06277762917 = getPosition(_trader)
1498+ let oldPositionSize = $t06277762917._1
1499+ let oldPositionMargin = $t06277762917._2
1500+ let oldPositionOpenNotional = $t06277762917._3
1501+ let oldPositionLstUpdCPF = $t06277762917._4
14531502 let marginDelta = -(_amount)
1454- let $t06148661665 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, marginDelta)
1455- let remainMargin = $t06148661665._1
1456- let badDebt = $t06148661665._2
1503+ let $t06295463133 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, marginDelta)
1504+ let remainMargin = $t06295463133._1
1505+ let badDebt = $t06295463133._2
14571506 if ((badDebt != 0))
14581507 then throw("Invalid removed margin amount")
14591508 else {
14621511 then throw(((("Too much margin removed: " + toString(marginRatio)) + " < ") + toString(initMarginRatio())))
14631512 else {
14641513 let quoteAssetStr = toBase58String(quoteAsset())
1465- let $t06210962163 = getBorrowedByTrader(_trader)
1466- let borrowed = $t06210962163._1
1467- let assetId = $t06210962163._2
1514+ let $t06357763631 = getBorrowedByTrader(_trader)
1515+ let borrowed = $t06357763631._1
1516+ let assetId = $t06357763631._2
14681517 let toRepay = if ((_amount > borrowed))
14691518 then borrowed
14701519 else _amount
14801529 else nil
14811530 if ((doSanityCheck == doSanityCheck))
14821531 then {
1483- let doUnstake = invoke(vaultAddress(), "withdrawLocked", [_amount], nil)
1532+ let doUnstake = if ((toWithdraw > 0))
1533+ then {
1534+ let doUnstake = invoke(vaultAddress(), "withdrawLocked", [toWithdraw], nil)
1535+ if ((doUnstake == doUnstake))
1536+ then nil
1537+ else throw("Strict value is not equal to itself.")
1538+ }
1539+ else nil
14841540 if ((doUnstake == doUnstake))
14851541 then {
14861542 let returnCollateralAction = if ((toRepay > 0))
14871543 then {
1488- let doRepay = invoke(collateralAddress(), "repay", [_trader, assetId], [AttachedPayment(quoteAsset(), toRepay)])
1544+ let doRepay = invoke(collateralAddress(), "repay", [_trader, toRepay, assetId], nil)
14891545 if ((doRepay == doRepay))
14901546 then [ScriptTransfer(i.caller, toRepay, fromBase58String(assetId))]
14911547 else throw("Strict value is not equal to itself.")
15271583 else (0 > _minQuoteAssetAmount))
15281584 then throw("Invalid closePosition parameters")
15291585 else {
1530- let $t06429364433 = getPosition(_trader)
1531- let oldPositionSize = $t06429364433._1
1532- let oldPositionMargin = $t06429364433._2
1533- let oldPositionOpenNotional = $t06429364433._3
1534- let oldPositionLstUpdCPF = $t06429364433._4
1535- let $t06443968811 = if ((abs(oldPositionSize) > _size))
1586+ let $t06578965929 = getPosition(_trader)
1587+ let oldPositionSize = $t06578965929._1
1588+ let oldPositionMargin = $t06578965929._2
1589+ let oldPositionOpenNotional = $t06578965929._3
1590+ let oldPositionLstUpdCPF = $t06578965929._4
1591+ let $t06593570372 = if ((abs(oldPositionSize) > _size))
15361592 then {
15371593 let _direction = if ((oldPositionSize > 0))
15381594 then DIR_SHORT
15391595 else DIR_LONG
15401596 let isAdd = (_direction == DIR_LONG)
1541- let $t06503065252 = swapOutput((oldPositionSize > 0), _size, true)
1542- let exchangedQuoteAssetAmount = $t06503065252._1
1543- let quoteAssetReserveAfter = $t06503065252._2
1544- let baseAssetReserveAfter = $t06503065252._3
1545- let totalPositionSizeAfter = $t06503065252._4
1597+ let $t06652666748 = swapOutput((oldPositionSize > 0), _size, true)
1598+ let exchangedQuoteAssetAmount = $t06652666748._1
1599+ let quoteAssetReserveAfter = $t06652666748._2
1600+ let baseAssetReserveAfter = $t06652666748._3
1601+ let totalPositionSizeAfter = $t06652666748._4
15461602 let exchangedPositionSize = if ((oldPositionSize > 0))
15471603 then -(_size)
15481604 else _size
1549- let $t06534365497 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1550- let oldPositionNotional = $t06534365497._1
1551- let unrealizedPnl = $t06534365497._2
1605+ let $t06683966993 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1606+ let oldPositionNotional = $t06683966993._1
1607+ let unrealizedPnl = $t06683966993._2
1608+ let mr = getMarginRatioByOption(_trader, PNL_OPTION_SPOT)
15521609 let realizedRatio = divd(abs(exchangedPositionSize), abs(oldPositionSize))
15531610 let realizedPnl = muld(unrealizedPnl, realizedRatio)
1554- let $t06571165949 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl)
1555- let remainMargin = $t06571165949._1
1556- let positionBadDebt = $t06571165949._2
1557- let fundingPayment = $t06571165949._3
1611+ let $t06727267510 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl)
1612+ let remainMargin = $t06727267510._1
1613+ let positionBadDebt = $t06727267510._2
1614+ let fundingPayment = $t06727267510._3
15581615 let unrealizedPnlAfter = (unrealizedPnl - realizedPnl)
15591616 let remainOpenNotional = if ((oldPositionSize > 0))
15601617 then ((oldPositionNotional - exchangedQuoteAssetAmount) - unrealizedPnlAfter)
15611618 else ((unrealizedPnlAfter + oldPositionNotional) - exchangedQuoteAssetAmount)
1562- let newPositionMargin = muld(remainMargin, realizedRatio)
1619+ let newPositionOpenNotional = abs(remainOpenNotional)
1620+ let newPositionMargin = muld(newPositionOpenNotional, mr)
15631621 let newPositionSize = (oldPositionSize + exchangedPositionSize)
1564- let newPositionOpenNotional = abs(remainOpenNotional)
15651622 let newPositionLstUpdCPF = latestCumulativePremiumFraction(newPositionSize)
15661623 let openInterestNotionalAfter = (openInterestNotional() - exchangedQuoteAssetAmount)
15671624 if (if ((_minQuoteAssetAmount != 0))
15811638 else if ((_size > abs(oldPositionSize)))
15821639 then throw("Invalid closePosition parameters")
15831640 else {
1584- let $t06775268171 = internalClosePosition(_trader, true)
1585- let exchangedQuoteAssetAmount = $t06775268171._1
1586- let positionBadDebt = $t06775268171._2
1587- let realizedPnl = $t06775268171._3
1588- let marginToVault = $t06775268171._4
1589- let quoteAssetReserveAfter = $t06775268171._5
1590- let baseAssetReserveAfter = $t06775268171._6
1591- let totalPositionSizeAfter = $t06775268171._7
1592- let openInterestNotionalAfter = $t06775268171._8
1593- let x2 = $t06775268171._9
1594- let totalLongAfter = $t06775268171._10
1595- let totalShortAfter = $t06775268171._11
1596- let totalLongOpenInterestAfter = $t06775268171._12
1597- let totalShortOpenInterestAfter = $t06775268171._13
1641+ let $t06931369732 = internalClosePosition(_trader, true)
1642+ let exchangedQuoteAssetAmount = $t06931369732._1
1643+ let positionBadDebt = $t06931369732._2
1644+ let realizedPnl = $t06931369732._3
1645+ let marginToVault = $t06931369732._4
1646+ let quoteAssetReserveAfter = $t06931369732._5
1647+ let baseAssetReserveAfter = $t06931369732._6
1648+ let totalPositionSizeAfter = $t06931369732._7
1649+ let openInterestNotionalAfter = $t06931369732._8
1650+ let x2 = $t06931369732._9
1651+ let totalLongAfter = $t06931369732._10
1652+ let totalShortAfter = $t06931369732._11
1653+ let totalLongOpenInterestAfter = $t06931369732._12
1654+ let totalShortOpenInterestAfter = $t06931369732._13
15981655 if (if ((_minQuoteAssetAmount != 0))
15991656 then (_minQuoteAssetAmount > exchangedQuoteAssetAmount)
16001657 else false)
16011658 then throw(((("Limit error: " + toString(exchangedQuoteAssetAmount)) + " < ") + toString(_minQuoteAssetAmount)))
16021659 else $Tuple15(0, 0, 0, 0, positionBadDebt, realizedPnl, marginToVault, quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)
16031660 }
1604- let newPositionSize = $t06443968811._1
1605- let newPositionMargin = $t06443968811._2
1606- let newPositionOpenNotional = $t06443968811._3
1607- let newPositionLstUpdCPF = $t06443968811._4
1608- let positionBadDebt = $t06443968811._5
1609- let realizedPnl = $t06443968811._6
1610- let marginToVault = $t06443968811._7
1611- let quoteAssetReserveAfter = $t06443968811._8
1612- let baseAssetReserveAfter = $t06443968811._9
1613- let totalPositionSizeAfter = $t06443968811._10
1614- let openInterestNotionalAfter = $t06443968811._11
1615- let totalLongAfter = $t06443968811._12
1616- let totalShortAfter = $t06443968811._13
1617- let totalLongOpenInterestAfter = $t06443968811._14
1618- let totalShortOpenInterestAfter = $t06443968811._15
1661+ let newPositionSize = $t06593570372._1
1662+ let newPositionMargin = $t06593570372._2
1663+ let newPositionOpenNotional = $t06593570372._3
1664+ let newPositionLstUpdCPF = $t06593570372._4
1665+ let positionBadDebt = $t06593570372._5
1666+ let realizedPnl = $t06593570372._6
1667+ let marginToVault = $t06593570372._7
1668+ let quoteAssetReserveAfter = $t06593570372._8
1669+ let baseAssetReserveAfter = $t06593570372._9
1670+ let totalPositionSizeAfter = $t06593570372._10
1671+ let openInterestNotionalAfter = $t06593570372._11
1672+ let totalLongAfter = $t06593570372._12
1673+ let totalShortAfter = $t06593570372._13
1674+ let totalLongOpenInterestAfter = $t06593570372._14
1675+ let totalShortOpenInterestAfter = $t06593570372._15
16191676 if ((positionBadDebt > 0))
16201677 then throw("Unable to close position with bad debt")
16211678 else {
16221679 let withdrawAmount = abs(marginToVault)
16231680 let ammBalance = (cbalance() - withdrawAmount)
1624- let $t06902069149 = if ((0 > ammBalance))
1681+ let $t07058170788 = if ((0 > ammBalance))
16251682 then $Tuple2(0, abs(ammBalance))
16261683 else $Tuple2(ammBalance, 0)
1627- let ammNewBalance = $t06902069149._1
1628- let x11 = $t06902069149._2
1629- let unstake = invoke(vaultAddress(), "withdrawLocked", [withdrawAmount], nil)
1630- if ((unstake == unstake))
1684+ let ammNewBalance = $t07058170788._1
1685+ let x11 = $t07058170788._2
1686+ let $t07079570849 = getBorrowedByTrader(_trader)
1687+ let borrowed = $t07079570849._1
1688+ let assetId = $t07079570849._2
1689+ let $t07086471723 = if ((borrowed > 0))
1690+ then if ((withdrawAmount >= borrowed))
1691+ then {
1692+ let doRepay = invoke(collateralAddress(), "repay", [_trader, borrowed, assetId], nil)
1693+ if ((doRepay == doRepay))
1694+ then $Tuple2([ScriptTransfer(_traderAddress, borrowed, fromBase58String(assetId))], (withdrawAmount - borrowed))
1695+ else throw("Strict value is not equal to itself.")
1696+ }
1697+ else {
1698+ let realizeAndClose = invoke(collateralAddress(), "realizePartiallyAndClose", [_trader, withdrawAmount, assetId], nil)
1699+ if ((realizeAndClose == realizeAndClose))
1700+ then $Tuple2([ScriptTransfer(_traderAddress, withdrawAmount, fromBase58String(assetId))], 0)
1701+ else throw("Strict value is not equal to itself.")
1702+ }
1703+ else $Tuple2(nil, withdrawAmount)
1704+ if (($t07086471723 == $t07086471723))
16311705 then {
1632- let $t06936169415 = getBorrowedByTrader(_trader)
1633- let borrowed = $t06936169415._1
1634- let assetId = $t06936169415._2
1635- let $t06943070347 = if ((borrowed > 0))
1636- then if ((withdrawAmount >= borrowed))
1637- then {
1638- let doRepay = invoke(collateralAddress(), "repay", [_trader, assetId], [AttachedPayment(quoteAsset(), borrowed)])
1639- if ((doRepay == doRepay))
1640- then $Tuple2([ScriptTransfer(_traderAddress, borrowed, fromBase58String(assetId))], (withdrawAmount - borrowed))
1641- else throw("Strict value is not equal to itself.")
1642- }
1643- else {
1644- let realizeAndClose = invoke(collateralAddress(), "realizePartiallyAndClose", [_trader, assetId], [AttachedPayment(quoteAsset(), withdrawAmount)])
1645- if ((realizeAndClose == realizeAndClose))
1646- then $Tuple2([ScriptTransfer(_traderAddress, withdrawAmount, fromBase58String(assetId))], 0)
1647- else throw("Strict value is not equal to itself.")
1648- }
1649- else $Tuple2(nil, withdrawAmount)
1650- if (($t06943070347 == $t06943070347))
1706+ let quoteWithdrawAmount = $t07086471723._2
1707+ let sendCollateralAction = $t07086471723._1
1708+ let unstake = if ((quoteWithdrawAmount > 0))
16511709 then {
1652- let quoteWithdrawAmount = $t06943070347._2
1653- let sendCollateralAction = $t06943070347._1
1710+ let unstake = invoke(vaultAddress(), "withdrawLocked", [quoteWithdrawAmount], nil)
1711+ if ((unstake == unstake))
1712+ then nil
1713+ else throw("Strict value is not equal to itself.")
1714+ }
1715+ else nil
1716+ if ((unstake == unstake))
1717+ then {
16541718 let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, 0], nil)
16551719 if ((notifyNotional == notifyNotional))
16561720 then (((((if ((newPositionSize == 0))
16971761 then (DECIMAL_UNIT > partialLiquidationRatio())
16981762 else false)
16991763 then {
1700- let $t07239672546 = getPosition(_trader)
1701- let oldPositionSize = $t07239672546._1
1702- let oldPositionMargin = $t07239672546._2
1703- let oldPositionOpenNotional = $t07239672546._3
1704- let oldPositionLstUpdCPF = $t07239672546._4
1764+ let $t07402074170 = getPosition(_trader)
1765+ let oldPositionSize = $t07402074170._1
1766+ let oldPositionMargin = $t07402074170._2
1767+ let oldPositionOpenNotional = $t07402074170._3
1768+ let oldPositionLstUpdCPF = $t07402074170._4
17051769 let _direction = if ((oldPositionSize > 0))
17061770 then DIR_SHORT
17071771 else DIR_LONG
17081772 let isAdd = (_direction == DIR_LONG)
17091773 let exchangedQuoteAssetAmount = getPartialLiquidationAmount(_trader, oldPositionSize)
1710- let $t07277172875 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1711- let oldPositionNotional = $t07277172875._1
1712- let unrealizedPnl = $t07277172875._2
1713- let $t07288373070 = swapInput(isAdd, exchangedQuoteAssetAmount)
1714- let exchangedPositionSize = $t07288373070._1
1715- let quoteAssetReserveAfter = $t07288373070._2
1716- let baseAssetReserveAfter = $t07288373070._3
1717- let totalPositionSizeAfter = $t07288373070._4
1774+ let $t07439574499 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1775+ let oldPositionNotional = $t07439574499._1
1776+ let unrealizedPnl = $t07439574499._2
1777+ let $t07450774694 = swapInput(isAdd, exchangedQuoteAssetAmount)
1778+ let exchangedPositionSize = $t07450774694._1
1779+ let quoteAssetReserveAfter = $t07450774694._2
1780+ let baseAssetReserveAfter = $t07450774694._3
1781+ let totalPositionSizeAfter = $t07450774694._4
17181782 let liquidationRatio = divd(abs(exchangedPositionSize), abs(oldPositionSize))
17191783 let realizedPnl = muld(unrealizedPnl, liquidationRatio)
1720- let $t07335973592 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl)
1721- let remainMargin = $t07335973592._1
1722- let badDebt = $t07335973592._2
1723- let fundingPayment = $t07335973592._3
1784+ let $t07498375216 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl)
1785+ let remainMargin = $t07498375216._1
1786+ let badDebt = $t07498375216._2
1787+ let fundingPayment = $t07498375216._3
17241788 let unrealizedPnlAfter = (unrealizedPnl - realizedPnl)
17251789 let remainOpenNotional = if ((oldPositionSize > 0))
17261790 then ((oldPositionNotional - exchangedQuoteAssetAmount) - unrealizedPnlAfter)
17271791 else ((unrealizedPnlAfter + oldPositionNotional) - exchangedQuoteAssetAmount)
17281792 let liquidationPenalty = muld(exchangedQuoteAssetAmount, liquidationFeeRatio())
17291793 let feeToLiquidator = (liquidationPenalty / 2)
1730- let feeToInsurance = (liquidationPenalty - feeToLiquidator)
1794+ let feeToVault = (liquidationPenalty - feeToLiquidator)
17311795 let newPositionMargin = (remainMargin - liquidationPenalty)
17321796 let newPositionSize = (oldPositionSize + exchangedPositionSize)
17331797 let newPositionOpenNotional = abs(remainOpenNotional)
17341798 let newPositionLstUpdCPF = latestCumulativePremiumFraction(newPositionSize)
17351799 let openInterestNotionalAfter = (openInterestNotional() - exchangedQuoteAssetAmount)
17361800 let ammBalance = (cbalance() - liquidationPenalty)
1737- let $t07476574894 = if ((0 > ammBalance))
1801+ let $t07638576514 = if ((0 > ammBalance))
17381802 then $Tuple2(0, abs(ammBalance))
17391803 else $Tuple2(ammBalance, 0)
1740- let newAmmBalance = $t07476574894._1
1741- let x11 = $t07476574894._2
1742- let $t07490274956 = getBorrowedByTrader(_trader)
1743- let borrowed = $t07490274956._1
1744- let assetId = $t07490274956._2
1804+ let newAmmBalance = $t07638576514._1
1805+ let x11 = $t07638576514._2
1806+ let $t07652276576 = getBorrowedByTrader(_trader)
1807+ let borrowed = $t07652276576._1
1808+ let assetId = $t07652276576._2
17451809 let doLiquidateCollateral = if ((borrowed > 0))
17461810 then {
17471811 let collateralToSell = muld(borrowed, liquidationRatio)
17561820 let unstake = invoke(vaultAddress(), "withdrawLocked", [liquidationPenalty], nil)
17571821 if ((unstake == unstake))
17581822 then {
1759- let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToInsurance)])
1823+ let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)])
17601824 if ((depositInsurance == depositInsurance))
17611825 then {
17621826 let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, newPositionOpenNotional], nil)
17791843 else throw("Strict value is not equal to itself.")
17801844 }
17811845 else {
1782- let $t07665577150 = internalClosePosition(_trader, false)
1783- let x1 = $t07665577150._1
1784- let badDebt = $t07665577150._2
1785- let x2 = $t07665577150._3
1786- let x3 = $t07665577150._4
1787- let quoteAssetReserveAfter = $t07665577150._5
1788- let baseAssetReserveAfter = $t07665577150._6
1789- let totalPositionSizeAfter = $t07665577150._7
1790- let openInterestNotionalAfter = $t07665577150._8
1791- let exchangedQuoteAssetAmount = $t07665577150._9
1792- let totalLongAfter = $t07665577150._10
1793- let totalShortAfter = $t07665577150._11
1794- let totalLongOpenInterestAfter = $t07665577150._12
1795- let totalShortOpenInterestAfter = $t07665577150._13
1846+ let $t07827178766 = internalClosePosition(_trader, false)
1847+ let x1 = $t07827178766._1
1848+ let badDebt = $t07827178766._2
1849+ let x2 = $t07827178766._3
1850+ let x3 = $t07827178766._4
1851+ let quoteAssetReserveAfter = $t07827178766._5
1852+ let baseAssetReserveAfter = $t07827178766._6
1853+ let totalPositionSizeAfter = $t07827178766._7
1854+ let openInterestNotionalAfter = $t07827178766._8
1855+ let exchangedQuoteAssetAmount = $t07827178766._9
1856+ let totalLongAfter = $t07827178766._10
1857+ let totalShortAfter = $t07827178766._11
1858+ let totalLongOpenInterestAfter = $t07827178766._12
1859+ let totalShortOpenInterestAfter = $t07827178766._13
17961860 let liquidationPenalty = muld(exchangedQuoteAssetAmount, liquidationFeeRatio())
17971861 let feeToLiquidator = (liquidationPenalty / 2)
1798- let feeToInsurance = (liquidationPenalty - feeToLiquidator)
1862+ let feeToVault = (liquidationPenalty - feeToLiquidator)
17991863 let ammBalance = (cbalance() - liquidationPenalty)
1800- let $t07756277691 = if ((0 > ammBalance))
1864+ let $t07917479303 = if ((0 > ammBalance))
18011865 then $Tuple2(0, abs(ammBalance))
18021866 else $Tuple2(ammBalance, 0)
1803- let newAmmBalance = $t07756277691._1
1804- let x11 = $t07756277691._2
1805- let $t07769977753 = getBorrowedByTrader(_trader)
1806- let borrowed = $t07769977753._1
1807- let assetId = $t07769977753._2
1867+ let newAmmBalance = $t07917479303._1
1868+ let x11 = $t07917479303._2
1869+ let $t07931179365 = getBorrowedByTrader(_trader)
1870+ let borrowed = $t07931179365._1
1871+ let assetId = $t07931179365._2
18081872 let doLiquidateCollateral = if ((borrowed > 0))
18091873 then {
1810- let realizeAndClose = invoke(collateralAddress(), "realizePartiallyAndClose", [_trader, assetId], nil)
1874+ let realizeAndClose = invoke(collateralAddress(), "realizePartiallyAndClose", [_trader, 0, assetId], nil)
18111875 if ((realizeAndClose == realizeAndClose))
18121876 then nil
18131877 else throw("Strict value is not equal to itself.")
18281892 let unstake = invoke(vaultAddress(), "withdrawLocked", [liquidationPenalty], nil)
18291893 if ((unstake == unstake))
18301894 then {
1831- let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToInsurance)])
1895+ let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)])
18321896 if ((depositInsurance == depositInsurance))
18331897 then {
18341898 let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, 0], nil)
18611925 then throw(((("Invalid funding block timestamp: " + toString(lastBlock.timestamp)) + " < ") + toString(fundingBlockTimestamp)))
18621926 else {
18631927 let underlyingPrice = getOracleTwapPrice()
1864- let $t07956079622 = getFunding()
1865- let shortPremiumFraction = $t07956079622._1
1866- let longPremiumFraction = $t07956079622._2
1928+ let $t08117281234 = getFunding()
1929+ let shortPremiumFraction = $t08117281234._1
1930+ let longPremiumFraction = $t08117281234._2
18671931 updateFunding((fundingBlockTimestamp + fundingPeriodSeconds()), (latestLongCumulativePremiumFraction() + longPremiumFraction), (latestShortCumulativePremiumFraction() + shortPremiumFraction), divd(longPremiumFraction, underlyingPrice), divd(shortPremiumFraction, underlyingPrice))
18681932 }
18691933 }
18721936
18731937 @Callable(i)
18741938 func syncTerminalPriceToOracle () = {
1875- let $t08000480125 = getSyncTerminalPrice(getOracleTwapPrice())
1876- let newQuoteAssetWeight = $t08000480125._1
1877- let newBaseAssetWeight = $t08000480125._2
1878- let marginToVault = $t08000480125._3
1879- let lockBadDebt = invoke(vaultAddress(), "exchangeFreeAndLocked", [marginToVault], nil)
1880- if ((lockBadDebt == lockBadDebt))
1939+ let $t08161681737 = getSyncTerminalPrice(getOracleTwapPrice())
1940+ let newQuoteAssetWeight = $t08161681737._1
1941+ let newBaseAssetWeight = $t08161681737._2
1942+ let marginToVault = $t08161681737._3
1943+ let doExchangePnL = if ((marginToVault != 0))
1944+ then {
1945+ let doExchangePnL = invoke(vaultAddress(), "exchangeFreeAndLocked", [marginToVault], nil)
1946+ if ((doExchangePnL == doExchangePnL))
1947+ then nil
1948+ else throw("Strict value is not equal to itself.")
1949+ }
1950+ else nil
1951+ if ((doExchangePnL == doExchangePnL))
18811952 then updateAmmWeights(newQuoteAssetWeight, newBaseAssetWeight)
18821953 else throw("Strict value is not equal to itself.")
18831954 }
18891960 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
18901961 if ((sync == sync))
18911962 then {
1892- let $t08050280603 = getPosition(_trader)
1893- let positionSize = $t08050280603._1
1894- let positionMargin = $t08050280603._2
1895- let pon = $t08050280603._3
1896- let positionLstUpdCPF = $t08050280603._4
1897- let $t08060680707 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1898- let positionNotional = $t08060680707._1
1899- let unrealizedPnl = $t08060680707._2
1900- let $t08071080882 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl)
1901- let remainMargin = $t08071080882._1
1902- let badDebt = $t08071080882._2
1903- let fundingPayment = $t08071080882._3
1963+ let $t08221382314 = getPosition(_trader)
1964+ let positionSize = $t08221382314._1
1965+ let positionMargin = $t08221382314._2
1966+ let pon = $t08221382314._3
1967+ let positionLstUpdCPF = $t08221382314._4
1968+ let $t08231782418 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1969+ let positionNotional = $t08231782418._1
1970+ let unrealizedPnl = $t08231782418._2
1971+ let $t08242182593 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl)
1972+ let remainMargin = $t08242182593._1
1973+ let badDebt = $t08242182593._2
1974+ let fundingPayment = $t08242182593._3
19041975 throw((((((s(remainMargin) + s(fundingPayment)) + s(getMarginRatio(_trader))) + s(unrealizedPnl)) + s(badDebt)) + s(positionNotional)))
19051976 }
19061977 else throw("Strict value is not equal to itself.")
19181989
19191990 @Callable(i)
19201991 func view_getTerminalAmmPrice () = {
1921- let $t08122981310 = getTerminalAmmState()
1922- let terminalQuoteAssetReserve = $t08122981310._1
1923- let terminalBaseAssetReserve = $t08122981310._2
1992+ let $t08294083021 = getTerminalAmmState()
1993+ let terminalQuoteAssetReserve = $t08294083021._1
1994+ let terminalBaseAssetReserve = $t08294083021._2
19241995 let price = divd(muld(terminalQuoteAssetReserve, qtAstW()), muld(terminalBaseAssetReserve, bsAstW()))
19251996 throw(toString(price))
19261997 }
19302001 @Callable(i)
19312002 func view_getFunding () = {
19322003 let underlyingPrice = getOracleTwapPrice()
1933- let $t08152981591 = getFunding()
1934- let shortPremiumFraction = $t08152981591._1
1935- let longPremiumFraction = $t08152981591._2
2004+ let $t08324083302 = getFunding()
2005+ let shortPremiumFraction = $t08324083302._1
2006+ let longPremiumFraction = $t08324083302._2
19362007 let longFunding = divd(longPremiumFraction, underlyingPrice)
19372008 let shortFunding = divd(shortPremiumFraction, underlyingPrice)
19382009 throw((((s(longFunding) + s(shortFunding)) + s(getTwapSpotPrice())) + s(getOracleTwapPrice())))
19422013
19432014 @Callable(i)
19442015 func view_getBorrowedByTrader (_trader) = {
1945- let $t08188181935 = getBorrowedByTrader(_trader)
1946- let borrowed = $t08188181935._1
1947- let assetId = $t08188181935._2
2016+ let $t08359283646 = getBorrowedByTrader(_trader)
2017+ let borrowed = $t08359283646._1
2018+ let assetId = $t08359283646._2
19482019 throw((s(borrowed) + assetId))
19492020 }
19502021
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let k_ora_key = "k_ora_key"
55
66 let k_ora_block_key = "k_ora_block_key"
77
88 let k_ora = "k_ora"
99
1010 let k_balance = "k_balance"
1111
1212 let k_sequence = "k_sequence"
1313
1414 let k_positionSize = "k_positionSize"
1515
1616 let k_positionMargin = "k_positionMargin"
1717
1818 let k_positionOpenNotional = "k_positionOpenNotional"
1919
2020 let k_positionLastUpdatedCumulativePremiumFraction = "k_positionFraction"
2121
2222 let k_positionSequence = "k_positionSequence"
2323
2424 let k_positionAsset = "k_positionAsset"
2525
2626 let k_initialized = "k_initialized"
2727
2828 let k_paused = "k_paused"
2929
3030 let k_closeOnly = "k_closeOnly"
3131
3232 let k_fee = "k_fee"
3333
3434 let k_fundingPeriod = "k_fundingPeriod"
3535
3636 let k_initMarginRatio = "k_initMarginRatio"
3737
3838 let k_maintenanceMarginRatio = "k_mmr"
3939
4040 let k_liquidationFeeRatio = "k_liquidationFeeRatio"
4141
4242 let k_partialLiquidationRatio = "k_partLiquidationRatio"
4343
4444 let k_spreadLimit = "k_spreadLimit"
4545
4646 let k_maxPriceImpact = "k_maxPriceImpact"
4747
4848 let k_maxPriceSpread = "k_maxPriceSpread"
4949
5050 let k_maxOpenNotional = "k_maxOpenNotional"
51+
52+let k_feeToStakersPercent = "k_feeToStakersPercent"
53+
54+let k_maxOracleDelay = "k_maxOracleDelay"
5155
5256 let k_lastDataStr = "k_lastDataStr"
5357
5458 let k_lastMinuteId = "k_lastMinuteId"
5559
5660 let k_twapDataLastCumulativePrice = "k_twapDataLastCumulativePrice"
5761
5862 let k_twapDataLastPrice = "k_twapDataLastPrice"
5963
6064 let k_twapDataPreviousMinuteId = "k_twapDataPreviousMinuteId"
6165
6266 let k_latestLongCumulativePremiumFraction = "k_latestLongPremiumFraction"
6367
6468 let k_latestShortCumulativePremiumFraction = "k_latestShortPremiumFraction"
6569
6670 let k_nextFundingBlock = "k_nextFundingBlockMinTimestamp"
6771
6872 let k_longFundingRate = "k_longFundingRate"
6973
7074 let k_shortFundingRate = "k_shortFundingRate"
7175
7276 let k_quoteAssetReserve = "k_qtAstR"
7377
7478 let k_baseAssetReserve = "k_bsAstR"
7579
7680 let k_quoteAssetWeight = "k_qtAstW"
7781
7882 let k_baseAssetWeight = "k_bsAstW"
7983
8084 let k_totalPositionSize = "k_totalPositionSize"
8185
8286 let k_totalLongPositionSize = "k_totalLongPositionSize"
8387
8488 let k_totalShortPositionSize = "k_totalShortPositionSize"
8589
8690 let k_openInterestNotional = "k_openInterestNotional"
8791
8892 let k_openInterestShort = "k_openInterestShort"
8993
9094 let k_openInterestLong = "k_openInterestLong"
9195
9296 let k_coordinatorAddress = "k_coordinatorAddress"
9397
9498 let k_vault_address = "k_vault_address"
9599
96100 let k_admin_address = "k_admin_address"
97101
98102 let k_admin_public_key = "k_admin_public_key"
99103
100104 let k_quote_asset = "k_quote_asset"
101105
102106 let k_quote_staking = "k_quote_staking"
103107
104108 let k_staking_address = "k_staking_address"
105109
106110 let k_miner_address = "k_miner_address"
107111
108112 let k_orders_address = "k_orders_address"
109113
110114 let k_referral_address = "k_referral_address"
111115
112116 let k_collateral_address = "k_collateral_address"
113117
114118 let k_exchange_address = "k_exchange_address"
115119
116120 let k_nft_manager_address = "k_nft_manager_address"
117121
118122 let k_trader_market_asset_collateral = "k_trader_market_asset_collateral"
119123
120124 func toCompositeKey (_key,_address) = ((_key + "_") + _address)
121125
122126
123127 func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set")
124128
125129
126130 func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address))
127131
128132
129133 func adminPublicKey () = fromBase58String(getStringValue(coordinator(), k_admin_public_key))
130134
131135
132136 func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset))
133137
134138
135139 func quoteAssetStaking () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_quote_staking)), "Quote asset staking not set")
136140
137141
138142 func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), "Staking not set")
139143
140144
141145 func vaultAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_vault_address)), "Vault not set")
142146
143147
144148 func minerAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_miner_address)), "Miner not set")
145149
146150
147151 func ordersAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_orders_address)), "Orders not set")
148152
149153
150154 func referralAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_referral_address)), "Referral not set")
151155
152156
153157 func nftManagerAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_nft_manager_address)), "NFT Manager not set")
154158
155159
156160 func collateralAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_collateral_address)), "Collateral Manager not set")
157161
158162
159163 func swapAddress () = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(coordinator(), k_exchange_address), "No swap address")), "Invalid swap address")
160164
161165
162166 let k_whitelist_asset = "k_whitelist_asset"
163167
164168 func isWhitelistAsset (_assetId) = valueOrElse(getBoolean(collateralAddress(), toCompositeKey(k_whitelist_asset, _assetId)), false)
165169
166170
167171 let k_token_param = "k_token_param"
168172
169173 let k_token_type = "k_token_type"
170174
171175 let FEE_REDUCTION_TOKEN_TYPE = "fee_reduction"
172176
173177 let DIR_LONG = 1
174178
175179 let DIR_SHORT = 2
176180
177181 let TWAP_INTERVAL = 15
178182
179183 let ORACLE_INTERVAL = 15
180184
181185 let SECONDS = 1000
182186
183187 let DECIMAL_NUMBERS = 6
184188
185189 let DECIMAL_UNIT = (1 * (((((10 * 10) * 10) * 10) * 10) * 10))
186190
187191 let ONE_DAY = (86400 * DECIMAL_UNIT)
188192
189193 let ALL_FEES = 100
190194
191195 let PNL_OPTION_SPOT = 1
192196
193197 let PNL_OPTION_ORACLE = 2
194198
195199 func s (_x) = (toString(_x) + ",")
196200
197201
198202 func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN)
199203
200204
201205 func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN)
202206
203207
204208 func sqrtd (_x) = sqrt(_x, DECIMAL_NUMBERS, DECIMAL_NUMBERS, HALFEVEN)
205209
206210
207211 func powd (_x,_y) = pow(_x, DECIMAL_NUMBERS, _y, DECIMAL_NUMBERS, DECIMAL_NUMBERS, HALFEVEN)
208212
209213
210214 func bdivd (_x,_y) = fraction(_x, toBigInt(DECIMAL_UNIT), _y, HALFEVEN)
211215
212216
213217 func bmuld (_x,_y) = fraction(_x, _y, toBigInt(DECIMAL_UNIT), HALFEVEN)
214218
215219
216220 func bsqrtd (_x) = sqrtBigInt(_x, DECIMAL_NUMBERS, DECIMAL_NUMBERS, HALFEVEN)
217221
218222
219223 func bpowd (_x,_y) = pow(_x, DECIMAL_NUMBERS, _y, DECIMAL_NUMBERS, DECIMAL_NUMBERS, HALFEVEN)
220224
221225
222226 func abs (_x) = if ((_x > 0))
223227 then _x
224228 else -(_x)
225229
226230
227231 func vmax (_x,_y) = if ((_x >= _y))
228232 then _x
229233 else _y
230234
231235
232236 func listToStr (_list) = {
233237 func _join (accumulator,val) = ((accumulator + val) + ",")
234238
235239 let newListStr = {
236240 let $l = _list
237241 let $s = size($l)
238242 let $acc0 = ""
239243 func $f0_1 ($a,$i) = if (($i >= $s))
240244 then $a
241245 else _join($a, $l[$i])
242246
243247 func $f0_2 ($a,$i) = if (($i >= $s))
244248 then $a
245249 else throw("List size exceeds 20")
246250
247251 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20)
248252 }
249253 let newListStrU = dropRight(newListStr, 1)
250254 let newListStrR = if ((take(newListStrU, 1) == ","))
251255 then drop(newListStrU, 1)
252256 else newListStrU
253257 newListStrR
254258 }
255259
256260
257261 func strToList (_str) = split(_str, ",")
258262
259263
260264 func pushToQueue (_list,_maxSize,_value) = if ((size(_list) > _maxSize))
261265 then (removeByIndex(_list, 0) :+ _value)
262266 else (_list :+ _value)
263267
264268
265269 func int (k) = valueOrErrorMessage(getInteger(this, k), ("no value for " + k))
266270
267271
268272 func intOr (k,def) = valueOrElse(getInteger(this, k), def)
269273
270274
271275 func strA (_address,_key) = {
272276 let val = valueOrErrorMessage(getString(_address, _key), ("No value for key " + _key))
273277 val
274278 }
275279
276280
277281 func intA (_address,_key) = {
278282 let val = valueOrErrorMessage(getInteger(_address, _key), ("No value for key " + _key))
279283 val
280284 }
281285
282286
283287 func cbalance () = int(k_balance)
284288
285289
286290 func fee () = int(k_fee)
287291
288292
289293 func initMarginRatio () = int(k_initMarginRatio)
290294
291295
292296 func qtAstR () = int(k_quoteAssetReserve)
293297
294298
295299 func bsAstR () = int(k_baseAssetReserve)
296300
297301
298302 func qtAstW () = intOr(k_quoteAssetWeight, DECIMAL_UNIT)
299303
300304
301305 func bsAstW () = intOr(k_baseAssetWeight, DECIMAL_UNIT)
302306
303307
304308 func totalPositionSize () = int(k_totalPositionSize)
305309
306310
307311 func openInterestNotional () = int(k_openInterestNotional)
308312
309313
310314 func openInterestShort () = int(k_openInterestShort)
311315
312316
313317 func openInterestLong () = int(k_openInterestLong)
314318
315319
316320 func nextFundingBlockTimestamp () = int(k_nextFundingBlock)
317321
318322
319323 func fundingPeriodRaw () = int(k_fundingPeriod)
320324
321325
322326 func fundingPeriodDecimal () = (fundingPeriodRaw() * DECIMAL_UNIT)
323327
324328
325329 func fundingPeriodSeconds () = (fundingPeriodRaw() * SECONDS)
326330
327331
328332 func maintenanceMarginRatio () = int(k_maintenanceMarginRatio)
329333
330334
331335 func liquidationFeeRatio () = int(k_liquidationFeeRatio)
332336
333337
334338 func partialLiquidationRatio () = int(k_partialLiquidationRatio)
335339
336340
337341 func spreadLimit () = int(k_spreadLimit)
338342
339343
340344 func maxPriceImpact () = int(k_maxPriceImpact)
341345
342346
343347 func maxPriceSpread () = int(k_maxPriceSpread)
344348
345349
346350 func maxOpenNotional () = int(k_maxOpenNotional)
347351
348352
349353 func latestLongCumulativePremiumFraction () = int(k_latestLongCumulativePremiumFraction)
350354
351355
352356 func latestShortCumulativePremiumFraction () = int(k_latestShortCumulativePremiumFraction)
353357
354358
355359 func totalShortPositionSize () = int(k_totalShortPositionSize)
356360
357361
358362 func totalLongPositionSize () = int(k_totalLongPositionSize)
359363
360364
361365 func lastSequence () = intOr(k_sequence, 0)
366+
367+
368+func feeToStakersPercent () = int(k_feeToStakersPercent)
369+
370+
371+func maxOracleDelay () = int(k_maxOracleDelay)
362372
363373
364374 func getActualCaller (i) = valueOrElse(getString(ordersAddress(), "k_sender"), toString(i.caller))
365375
366376
367377 func requireMoreMarginRatio (_marginRatio,_baseMarginRatio,_largerThanOrEqualTo) = {
368378 let remainingMarginRatio = (_marginRatio - _baseMarginRatio)
369379 if (if (_largerThanOrEqualTo)
370380 then (0 > remainingMarginRatio)
371381 else false)
372382 then throw("Invalid margin")
373383 else if (if (!(_largerThanOrEqualTo))
374384 then (remainingMarginRatio >= 0)
375385 else false)
376386 then throw("Invalid margin")
377387 else true
378388 }
379389
380390
381391 func latestCumulativePremiumFraction (_positionSize) = if ((_positionSize == 0))
382392 then throw("Should not be called with _positionSize == 0")
383393 else if ((_positionSize > 0))
384394 then latestLongCumulativePremiumFraction()
385395 else latestShortCumulativePremiumFraction()
386396
387397
388398 func getPosition (_trader) = {
389399 let positionSizeOpt = getInteger(this, toCompositeKey(k_positionSize, _trader))
390400 match positionSizeOpt {
391401 case positionSize: Int =>
392402 $Tuple4(positionSize, getIntegerValue(this, toCompositeKey(k_positionMargin, _trader)), getIntegerValue(this, toCompositeKey(k_positionOpenNotional, _trader)), getIntegerValue(this, toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _trader)))
393403 case _ =>
394404 $Tuple4(0, 0, 0, 0)
395405 }
396406 }
397407
398408
399409 func getPositionAsset (_trader) = {
400410 let positionAssetOpt = getString(this, toCompositeKey(k_positionAsset, _trader))
401411 match positionAssetOpt {
402412 case positionAsset: String =>
403413 positionAsset
404414 case _ =>
405415 toBase58String(quoteAsset())
406416 }
407417 }
408418
409419
410420 func requireOpenPosition (_trader) = if ((getPosition(_trader)._1 == 0))
411421 then throw("No open position")
412422 else true
413423
414424
415425 func initialized () = valueOrElse(getBoolean(this, k_initialized), false)
416426
417427
418428 func paused () = valueOrElse(getBoolean(this, k_paused), false)
419429
420430
421431 func closeOnly () = valueOrElse(getBoolean(this, k_closeOnly), false)
422432
423433
424434 func updateReserve (_isAdd,_quoteAssetAmount,_baseAssetAmount) = if (_isAdd)
425435 then {
426436 let newBase = (bsAstR() - _baseAssetAmount)
427437 if ((0 >= newBase))
428438 then throw("Tx lead to base asset reserve <= 0, revert")
429439 else $Tuple3((qtAstR() + _quoteAssetAmount), newBase, (totalPositionSize() + _baseAssetAmount))
430440 }
431441 else {
432442 let newQuote = (qtAstR() - _quoteAssetAmount)
433443 if ((0 >= newQuote))
434444 then throw("Tx lead to base quote reserve <= 0, revert")
435445 else $Tuple3(newQuote, (bsAstR() + _baseAssetAmount), (totalPositionSize() - _baseAssetAmount))
436446 }
437447
438448
439449 func calcInvariant (_qtAstR,_qtAstW,_bsAstR,_bsAstW) = {
440450 let bqtAstR = toBigInt(_qtAstR)
441451 let bqtAstW = toBigInt(_qtAstW)
442452 let bbsAstR = toBigInt(_bsAstR)
443453 let bbsAstW = toBigInt(_bsAstW)
444454 bmuld(bmuld(bqtAstR, bqtAstW), bmuld(bbsAstR, bbsAstW))
445455 }
446456
447457
448458 func swapInput (_isAdd,_quoteAssetAmount) = {
449459 let _qtAstR = qtAstR()
450460 let _bsAstR = bsAstR()
451461 let _qtAstW = qtAstW()
452462 let _bsAstW = bsAstW()
453463 let k = calcInvariant(_qtAstR, _qtAstW, _bsAstR, _bsAstW)
454464 let quoteAssetReserveAfter = if (_isAdd)
455465 then (_qtAstR + _quoteAssetAmount)
456466 else (_qtAstR - _quoteAssetAmount)
457467 let baseAssetReserveAfter = toInt(bdivd(k, toBigInt(muld(quoteAssetReserveAfter, _qtAstW))))
458468 let amountBaseAssetBoughtAbs = divd(abs((baseAssetReserveAfter - _bsAstR)), _qtAstW)
459469 let amountBaseAssetBought = if (_isAdd)
460470 then amountBaseAssetBoughtAbs
461471 else -(amountBaseAssetBoughtAbs)
462- let $t01665516818 = updateReserve(_isAdd, _quoteAssetAmount, amountBaseAssetBoughtAbs)
463- let quoteAssetReserveAfter1 = $t01665516818._1
464- let baseAssetReserveAfter1 = $t01665516818._2
465- let totalPositionSizeAfter1 = $t01665516818._3
472+ let $t01694617109 = updateReserve(_isAdd, _quoteAssetAmount, amountBaseAssetBoughtAbs)
473+ let quoteAssetReserveAfter1 = $t01694617109._1
474+ let baseAssetReserveAfter1 = $t01694617109._2
475+ let totalPositionSizeAfter1 = $t01694617109._3
466476 let priceBefore = divd(muld(_qtAstR, _qtAstW), muld(_bsAstR, _bsAstW))
467477 let marketPrice = divd(_quoteAssetAmount, amountBaseAssetBoughtAbs)
468478 let priceDiff = abs((priceBefore - marketPrice))
469479 let priceImpact = (DECIMAL_UNIT - divd(priceBefore, (priceBefore + priceDiff)))
470480 let maxPriceImpactValue = maxPriceImpact()
471481 if ((priceImpact > maxPriceImpactValue))
472482 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)))
473483 else $Tuple4(amountBaseAssetBought, quoteAssetReserveAfter1, baseAssetReserveAfter1, totalPositionSizeAfter1)
474484 }
475485
476486
477487 func calcRemainMarginWithFundingPayment (_oldPositionSize,_oldPositionMargin,_oldPositionCumulativePremiumFraction,_marginDelta) = {
478488 let fundingPayment = if ((_oldPositionSize != 0))
479489 then {
480490 let _latestCumulativePremiumFraction = latestCumulativePremiumFraction(_oldPositionSize)
481491 muld((_latestCumulativePremiumFraction - _oldPositionCumulativePremiumFraction), _oldPositionSize)
482492 }
483493 else 0
484494 let signedMargin = ((_marginDelta - fundingPayment) + _oldPositionMargin)
485- let $t01830518432 = if ((0 > signedMargin))
495+ let $t01859618723 = if ((0 > signedMargin))
486496 then $Tuple2(0, abs(signedMargin))
487497 else $Tuple2(abs(signedMargin), 0)
488- let remainMargin = $t01830518432._1
489- let badDebt = $t01830518432._2
498+ let remainMargin = $t01859618723._1
499+ let badDebt = $t01859618723._2
490500 $Tuple3(remainMargin, badDebt, fundingPayment)
491501 }
492502
493503
494504 func swapOutputWithReserves (_isAdd,_baseAssetAmount,_checkMaxPriceImpact,_quoteAssetReserve,_quoteAssetWeight,_baseAssetReserve,_baseAssetWeight) = {
495505 let priceBefore = divd(muld(_quoteAssetReserve, _quoteAssetWeight), muld(_baseAssetReserve, _baseAssetWeight))
496506 if ((_baseAssetAmount == 0))
497507 then throw("Invalid base asset amount")
498508 else {
499509 let k = calcInvariant(_quoteAssetReserve, _quoteAssetWeight, _baseAssetReserve, _baseAssetWeight)
500510 let baseAssetPoolAmountAfter = if (_isAdd)
501511 then (_baseAssetReserve + _baseAssetAmount)
502512 else (_baseAssetReserve - _baseAssetAmount)
503513 let quoteAssetAfter = toInt(bdivd(k, toBigInt(muld(baseAssetPoolAmountAfter, _baseAssetWeight))))
504514 let quoteAssetSold = abs((quoteAssetAfter - muld(_quoteAssetReserve, _quoteAssetWeight)))
505515 let maxPriceImpactValue = maxPriceImpact()
506- let $t01962019781 = updateReserve(!(_isAdd), quoteAssetSold, _baseAssetAmount)
507- let quoteAssetReserveAfter1 = $t01962019781._1
508- let baseAssetReserveAfter1 = $t01962019781._2
509- let totalPositionSizeAfter1 = $t01962019781._3
516+ let $t01991120072 = updateReserve(!(_isAdd), quoteAssetSold, _baseAssetAmount)
517+ let quoteAssetReserveAfter1 = $t01991120072._1
518+ let baseAssetReserveAfter1 = $t01991120072._2
519+ let totalPositionSizeAfter1 = $t01991120072._3
510520 let marketPrice = divd(quoteAssetSold, _baseAssetAmount)
511521 let priceDiff = abs((priceBefore - marketPrice))
512522 let priceImpact = (DECIMAL_UNIT - divd(priceBefore, (priceBefore + priceDiff)))
513523 if (if ((priceImpact > maxPriceImpactValue))
514524 then _checkMaxPriceImpact
515525 else false)
516526 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)))
517527 else $Tuple7(quoteAssetSold, quoteAssetReserveAfter1, baseAssetReserveAfter1, totalPositionSizeAfter1, (totalLongPositionSize() - (if (_isAdd)
518528 then abs(_baseAssetAmount)
519529 else 0)), (totalShortPositionSize() - (if (!(_isAdd))
520530 then abs(_baseAssetAmount)
521531 else 0)), priceImpact)
522532 }
523533 }
524534
525535
526536 func swapOutput (_isAdd,_baseAssetAmount,_checkMaxPriceImpact) = swapOutputWithReserves(_isAdd, _baseAssetAmount, _checkMaxPriceImpact, qtAstR(), qtAstW(), bsAstR(), bsAstW())
527537
528538
529539 func getOracleTwapPrice () = {
530540 let oracle = valueOrErrorMessage(addressFromString(getStringValue(this, k_ora)), "")
531541 let priceKey = getStringValue(this, k_ora_key)
532- let blockKey = getStringValue(this, k_ora_block_key)
533542 let lastValue = valueOrErrorMessage(getInteger(oracle, priceKey), ((("Can not get oracle price. Oracle: " + toString(oracle)) + " key: ") + priceKey))
534- lastValue
543+ let blockKey = valueOrElse(getString(this, k_ora_block_key), "")
544+ if ((blockKey != ""))
545+ then {
546+ let currentBlock = lastBlock.height
547+ let lastOracleBlock = valueOrErrorMessage(getInteger(oracle, k_ora_block_key), ((("Can not get oracle block. Oracle: " + toString(oracle)) + " key: ") + blockKey))
548+ if (((currentBlock - lastOracleBlock) > maxOracleDelay()))
549+ then throw(((("Oracle stale data. Last oracle block: " + toString(lastOracleBlock)) + " current block: ") + toString(currentBlock)))
550+ else lastValue
551+ }
552+ else lastValue
535553 }
536554
537555
538556 func requireNotOverSpreadLimit (_quoteAssetReserve,_baseAssetReserve) = {
539557 let oraclePrice = getOracleTwapPrice()
540- let priceAfter = divd(_quoteAssetReserve, _baseAssetReserve)
558+ let _qtAstW = qtAstW()
559+ let _bsAstW = bsAstW()
560+ let priceAfter = divd(muld(_quoteAssetReserve, _qtAstW), muld(_baseAssetReserve, _bsAstW))
541561 let averagePrice = divd((oraclePrice + priceAfter), (2 * DECIMAL_UNIT))
542562 let absPriceDiff = divd(abs((oraclePrice - priceAfter)), averagePrice)
543563 if ((absPriceDiff > maxPriceSpread()))
544564 then throw(((("Price spread " + toString(absPriceDiff)) + " > max price spread ") + toString(maxPriceSpread())))
545565 else true
546566 }
547567
548568
549569 func requireNotOverMaxOpenNotional (_longOpenNotional,_shortOpenNotional) = {
550570 let _maxOpenNotional = maxOpenNotional()
551571 if ((_longOpenNotional > _maxOpenNotional))
552572 then throw(((("Long open notional " + toString(_longOpenNotional)) + " > max open notional ") + toString(_maxOpenNotional)))
553573 else if ((_shortOpenNotional > _maxOpenNotional))
554574 then throw(((("Short open notional " + toString(_shortOpenNotional)) + " > max open notional ") + toString(_maxOpenNotional)))
555575 else true
556576 }
557577
558578
559579 func getSpotPrice () = {
560580 let _quoteAssetReserve = qtAstR()
561581 let _baseAssetReserve = bsAstR()
562582 let _qtAstW = qtAstW()
563583 let _bsAstW = bsAstW()
564584 divd(muld(_quoteAssetReserve, _qtAstW), muld(_baseAssetReserve, _bsAstW))
565585 }
566586
567587
568588 func isOverFluctuationLimit () = {
569589 let oraclePrice = getOracleTwapPrice()
570590 let currentPrice = getSpotPrice()
571591 (divd(abs((oraclePrice - currentPrice)), oraclePrice) > spreadLimit())
572592 }
573593
574594
575595 func getPositionAdjustedOpenNotional (_positionSize,_option,_quoteAssetReserve,_quoteAssetWeight,_baseAssetReserve,_baseAssetWeight) = {
576596 let positionSizeAbs = abs(_positionSize)
577597 let isShort = (0 > _positionSize)
578598 let positionNotional = if ((_option == PNL_OPTION_SPOT))
579599 then {
580- let $t02365523875 = swapOutputWithReserves(!(isShort), positionSizeAbs, false, _quoteAssetReserve, _quoteAssetWeight, _baseAssetReserve, _baseAssetWeight)
581- let outPositionNotional = $t02365523875._1
582- let x1 = $t02365523875._2
583- let x2 = $t02365523875._3
584- let x3 = $t02365523875._4
600+ let $t02423824458 = swapOutputWithReserves(!(isShort), positionSizeAbs, false, _quoteAssetReserve, _quoteAssetWeight, _baseAssetReserve, _baseAssetWeight)
601+ let outPositionNotional = $t02423824458._1
602+ let x1 = $t02423824458._2
603+ let x2 = $t02423824458._3
604+ let x3 = $t02423824458._4
585605 outPositionNotional
586606 }
587607 else muld(positionSizeAbs, getOracleTwapPrice())
588608 positionNotional
589609 }
590610
591611
592612 func getPositionNotionalAndUnrealizedPnlByValues (_positionSize,_positionOpenNotional,_quoteAssetReserve,_quoteAssetWeight,_baseAssetReserve,_baseAssetWeight,_option) = if ((_positionSize == 0))
593613 then throw("Invalid position size")
594614 else {
595615 let isShort = (0 > _positionSize)
596616 let positionNotional = getPositionAdjustedOpenNotional(_positionSize, _option, _quoteAssetReserve, _quoteAssetWeight, _baseAssetReserve, _baseAssetWeight)
597617 let unrealizedPnl = if (isShort)
598618 then (_positionOpenNotional - positionNotional)
599619 else (positionNotional - _positionOpenNotional)
600620 $Tuple2(positionNotional, unrealizedPnl)
601621 }
602622
603623
604624 func getPositionNotionalAndUnrealizedPnl (_trader,_option) = {
605- let $t02530025428 = getPosition(_trader)
606- let positionSize = $t02530025428._1
607- let positionMargin = $t02530025428._2
608- let positionOpenNotional = $t02530025428._3
609- let positionLstUpdCPF = $t02530025428._4
625+ let $t02588326011 = getPosition(_trader)
626+ let positionSize = $t02588326011._1
627+ let positionMargin = $t02588326011._2
628+ let positionOpenNotional = $t02588326011._3
629+ let positionLstUpdCPF = $t02588326011._4
610630 getPositionNotionalAndUnrealizedPnlByValues(positionSize, positionOpenNotional, qtAstR(), qtAstW(), bsAstR(), bsAstW(), _option)
611631 }
612632
613633
614634 func calcMarginRatio (_remainMargin,_badDebt,_positionNotional) = divd((_remainMargin - _badDebt), _positionNotional)
615635
616636
617637 func getMarginRatioByOption (_trader,_option) = {
618- let $t02594126052 = getPosition(_trader)
619- let positionSize = $t02594126052._1
620- let positionMargin = $t02594126052._2
621- let pon = $t02594126052._3
622- let positionLstUpdCPF = $t02594126052._4
623- let $t02605826151 = getPositionNotionalAndUnrealizedPnl(_trader, _option)
624- let positionNotional = $t02605826151._1
625- let unrealizedPnl = $t02605826151._2
626- let $t02615626322 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl)
627- let remainMargin = $t02615626322._1
628- let badDebt = $t02615626322._2
638+ let $t02652426635 = getPosition(_trader)
639+ let positionSize = $t02652426635._1
640+ let positionMargin = $t02652426635._2
641+ let pon = $t02652426635._3
642+ let positionLstUpdCPF = $t02652426635._4
643+ let $t02664126734 = getPositionNotionalAndUnrealizedPnl(_trader, _option)
644+ let positionNotional = $t02664126734._1
645+ let unrealizedPnl = $t02664126734._2
646+ let $t02673926905 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl)
647+ let remainMargin = $t02673926905._1
648+ let badDebt = $t02673926905._2
629649 calcMarginRatio(remainMargin, badDebt, positionNotional)
630650 }
631651
632652
633653 func getMarginRatio (_trader) = getMarginRatioByOption(_trader, PNL_OPTION_SPOT)
634654
635655
636656 func getPartialLiquidationAmount (_trader,_positionSize) = {
637657 let maximumRatio = vmax(partialLiquidationRatio(), (DECIMAL_UNIT - divd(getMarginRatio(_trader), maintenanceMarginRatio())))
638658 let maxExchangedPositionSize = muld(abs(_positionSize), maximumRatio)
639659 let swapResult = swapOutput((_positionSize > 0), maxExchangedPositionSize, false)
640660 let maxExchangedQuoteAssetAmount = swapResult._1
641661 let priceImpact = swapResult._7
642662 if ((maxPriceImpact() > priceImpact))
643663 then maxExchangedQuoteAssetAmount
644664 else {
645665 let exchangedPositionSize = muld(abs(_positionSize), partialLiquidationRatio())
646666 let exchangedQuoteAssetAmount = swapOutput((_positionSize > 0), exchangedPositionSize, false)._1
647667 exchangedQuoteAssetAmount
648668 }
649669 }
650670
651671
652672 func internalClosePosition (_trader,_checkMaxPriceImpact) = {
653- let $t02756227690 = getPosition(_trader)
654- let positionSize = $t02756227690._1
655- let positionMargin = $t02756227690._2
656- let positionOpenNotional = $t02756227690._3
657- let positionLstUpdCPF = $t02756227690._4
673+ let $t02814528273 = getPosition(_trader)
674+ let positionSize = $t02814528273._1
675+ let positionMargin = $t02814528273._2
676+ let positionOpenNotional = $t02814528273._3
677+ let positionLstUpdCPF = $t02814528273._4
658678 let unrealizedPnl = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)._2
659- let $t02778527953 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl)
660- let remainMargin = $t02778527953._1
661- let badDebt = $t02778527953._2
679+ let $t02836828536 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl)
680+ let remainMargin = $t02836828536._1
681+ let badDebt = $t02836828536._2
662682 let exchangedPositionSize = -(positionSize)
663683 let realizedPnl = unrealizedPnl
664684 let marginToVault = -(remainMargin)
665- let $t02808028354 = swapOutput((positionSize > 0), abs(positionSize), _checkMaxPriceImpact)
666- let exchangedQuoteAssetAmount = $t02808028354._1
667- let quoteAssetReserveAfter = $t02808028354._2
668- let baseAssetReserveAfter = $t02808028354._3
669- let totalPositionSizeAfter = $t02808028354._4
670- let totalLongAfter = $t02808028354._5
671- let totalShortAfter = $t02808028354._6
685+ let $t02866328937 = swapOutput((positionSize > 0), abs(positionSize), _checkMaxPriceImpact)
686+ let exchangedQuoteAssetAmount = $t02866328937._1
687+ let quoteAssetReserveAfter = $t02866328937._2
688+ let baseAssetReserveAfter = $t02866328937._3
689+ let totalPositionSizeAfter = $t02866328937._4
690+ let totalLongAfter = $t02866328937._5
691+ let totalShortAfter = $t02866328937._6
672692 let openInterestNotionalAfter = (openInterestNotional() - positionOpenNotional)
673693 $Tuple13(exchangedPositionSize, badDebt, realizedPnl, marginToVault, quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, exchangedQuoteAssetAmount, totalLongAfter, totalShortAfter, (openInterestLong() - (if ((positionSize > 0))
674694 then positionOpenNotional
675695 else 0)), (openInterestShort() - (if ((0 > positionSize))
676696 then positionOpenNotional
677697 else 0)))
678698 }
679699
680700
681701 func getTwapSpotPrice () = {
682702 let minuteId = ((lastBlock.timestamp / 1000) / 60)
683703 let startMinuteId = (minuteId - TWAP_INTERVAL)
684704 let listStr = valueOrElse(getString(this, k_lastDataStr), "")
685705 let list = split(listStr, ",")
686706 func filterFn (accumulator,next) = if ((startMinuteId >= parseIntValue(next)))
687707 then (accumulator :+ parseIntValue(next))
688708 else accumulator
689709
690710 let listF = {
691711 let $l = list
692712 let $s = size($l)
693713 let $acc0 = nil
694714 func $f0_1 ($a,$i) = if (($i >= $s))
695715 then $a
696716 else filterFn($a, $l[$i])
697717
698718 func $f0_2 ($a,$i) = if (($i >= $s))
699719 then $a
700720 else throw("List size exceeds 20")
701721
702722 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20)
703723 }
704724 let maxIndex = if ((size(listF) > 0))
705725 then max(listF)
706726 else parseIntValue(list[0])
707727 let lastMinuteId = valueOrElse(getInteger(this, k_lastMinuteId), 0)
708728 let endLastCumulativePrice = valueOrElse(getInteger(this, ((k_twapDataLastCumulativePrice + "_") + toString(lastMinuteId))), 0)
709729 let endLastPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(lastMinuteId))), 0)
710730 let nowCumulativePrice = (endLastCumulativePrice + ((minuteId - lastMinuteId) * endLastPrice))
711731 let startLastCumulativePrice = valueOrElse(getInteger(this, ((k_twapDataLastCumulativePrice + "_") + toString(maxIndex))), 0)
712732 let startLastPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(maxIndex))), 0)
713733 let startCumulativePrice = (startLastCumulativePrice + ((startMinuteId - maxIndex) * startLastPrice))
714734 ((nowCumulativePrice - startCumulativePrice) / TWAP_INTERVAL)
715735 }
716736
717737
718738 func getTerminalAmmState () = {
719739 let _positionSize = totalPositionSize()
720740 if ((_positionSize == 0))
721741 then $Tuple2(qtAstR(), bsAstR())
722742 else {
723743 let direction = (_positionSize > 0)
724- let $t03047730656 = swapOutput(direction, abs(_positionSize), false)
725- let currentNetMarketValue = $t03047730656._1
726- let terminalQuoteAssetReserve = $t03047730656._2
727- let terminalBaseAssetReserve = $t03047730656._3
744+ let $t03106031239 = swapOutput(direction, abs(_positionSize), false)
745+ let currentNetMarketValue = $t03106031239._1
746+ let terminalQuoteAssetReserve = $t03106031239._2
747+ let terminalBaseAssetReserve = $t03106031239._3
728748 $Tuple2(terminalQuoteAssetReserve, terminalBaseAssetReserve)
729749 }
730750 }
731751
732752
733753 func getQuoteAssetWeight (baseAssetReserve,totalPositionSize,quoteAssetReserve,targetPrice) = {
734754 let b = toBigInt(baseAssetReserve)
735755 let sz = toBigInt(totalPositionSize)
736756 let q = toBigInt(quoteAssetReserve)
737757 let p = toBigInt(targetPrice)
738758 let bs2 = bpowd((b + sz), toBigInt((2 * DECIMAL_UNIT)))
739759 let qbs2 = bmuld(q, bs2)
740760 let ps4 = (toBigInt(4) * bmuld(p, sz))
741761 let sqr = bsqrtd(bmuld(qbs2, (q - ps4)))
742762 let bq = bmuld(b, q)
743763 let qs = bmuld(q, sz)
744764 let top = ((-(sqr) + bq) + qs)
745765 let bot = (toBigInt(2) * bmuld(q, sz))
746766 let result = bdivd(top, bot)
747767 toInt(result)
748768 }
749769
750770
751771 func getSyncTerminalPrice (_terminalPrice) = {
752772 let _positionSize = totalPositionSize()
753773 if ((_positionSize == 0))
754774 then {
755775 let _qtAstR = qtAstR()
756776 let _bsAstR = bsAstR()
757777 let newQtAstW = divd(muld(_terminalPrice, _bsAstR), _qtAstR)
758778 $Tuple3(newQtAstW, DECIMAL_UNIT, 0)
759779 }
760780 else {
761781 let direction = (_positionSize > 0)
762782 let currentNetMarketValue = swapOutput(direction, abs(_positionSize), false)._1
763783 let _qtAstR = qtAstR()
764784 let _bsAstR = bsAstR()
765785 let newQtAstW = getQuoteAssetWeight(_bsAstR, _positionSize, _qtAstR, _terminalPrice)
766786 let newBsAstW = DECIMAL_UNIT
767787 let marginToVault = getPositionNotionalAndUnrealizedPnlByValues(_positionSize, currentNetMarketValue, _qtAstR, newQtAstW, _bsAstR, newBsAstW, PNL_OPTION_SPOT)._2
768788 $Tuple3(newQtAstW, newBsAstW, marginToVault)
769789 }
770790 }
771791
772792
773793 func getFunding () = {
774794 let underlyingPrice = getOracleTwapPrice()
775795 let spotTwapPrice = getTwapSpotPrice()
776796 let premium = (spotTwapPrice - underlyingPrice)
777797 if (if ((totalShortPositionSize() == 0))
778798 then true
779799 else (totalLongPositionSize() == 0))
780800 then $Tuple2(0, 0)
781801 else if ((0 > premium))
782802 then {
783803 let shortPremiumFraction = divd(muld(premium, fundingPeriodDecimal()), ONE_DAY)
784804 let longPremiumFraction = divd(muld(shortPremiumFraction, totalShortPositionSize()), totalLongPositionSize())
785805 $Tuple2(shortPremiumFraction, longPremiumFraction)
786806 }
787807 else {
788808 let longPremiumFraction = divd(muld(premium, fundingPeriodDecimal()), ONE_DAY)
789809 let shortPremiumFraction = divd(muld(longPremiumFraction, totalLongPositionSize()), totalShortPositionSize())
790810 $Tuple2(shortPremiumFraction, longPremiumFraction)
791811 }
792812 }
793813
794814
795815 func getAdjustedFee (_artifactId,_baseFeeDiscount) = {
796816 let baseFeeRaw = fee()
797817 let baseFee = muld(baseFeeRaw, _baseFeeDiscount)
798- let $t03375534250 = if ((_artifactId != ""))
818+ let $t03433834833 = if ((_artifactId != ""))
799819 then {
800820 let artifactKind = strA(nftManagerAddress(), toCompositeKey(k_token_type, _artifactId))
801821 if ((artifactKind == FEE_REDUCTION_TOKEN_TYPE))
802822 then {
803823 let reduction = intA(nftManagerAddress(), toCompositeKey(k_token_param, _artifactId))
804824 let adjustedFee = muld(baseFee, reduction)
805825 $Tuple2(adjustedFee, true)
806826 }
807827 else throw("Invalid attached artifact")
808828 }
809829 else $Tuple2(baseFee, false)
810- let adjustedFee = $t03375534250._1
811- let burnArtifact = $t03375534250._2
830+ let adjustedFee = $t03433834833._1
831+ let burnArtifact = $t03433834833._2
812832 $Tuple2(adjustedFee, burnArtifact)
813833 }
814834
815835
816-func updateSettings (_initMarginRatio,_mmr,_liquidationFeeRatio,_fundingPeriod,_fee,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread,_maxOpenNotional) = [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)]
836+func isSameAssetOrNoPosition (_trader,_assetId) = {
837+ let oldPositionSize = getPosition(_trader)._1
838+ if ((oldPositionSize == 0))
839+ then true
840+ else (getPositionAsset(_trader) == _assetId)
841+ }
842+
843+
844+func isSameAsset (_trader,_assetId) = (getPositionAsset(_trader) == _assetId)
845+
846+
847+func getBorrowedByTraderInMarketKey (_amm,_assetId,_trader) = ((((((k_trader_market_asset_collateral + "_") + _amm) + "_") + _assetId) + "_") + _trader)
848+
849+
850+func getBorrowedByTrader (_trader) = {
851+ let positionAsset = getPositionAsset(_trader)
852+ if ((positionAsset == toBase58String(quoteAsset())))
853+ then $Tuple2(0, positionAsset)
854+ else {
855+ let key = getBorrowedByTraderInMarketKey(toString(this), positionAsset, _trader)
856+ let borrow = valueOrElse(getInteger(collateralAddress(), key), 0)
857+ $Tuple2(borrow, positionAsset)
858+ }
859+ }
860+
861+
862+func getForTraderWithArtifact (_trader,_artifactId) = {
863+ let doGetFeeDiscount = invoke(minerAddress(), "computeFeeDiscount", [_trader], nil)
864+ if ((doGetFeeDiscount == doGetFeeDiscount))
865+ then {
866+ let feeDiscount = match doGetFeeDiscount {
867+ case x: Int =>
868+ x
869+ case _ =>
870+ throw("Invalid computeFeeDiscount result")
871+ }
872+ let $t03606436138 = getAdjustedFee(_artifactId, feeDiscount)
873+ let adjustedFee = $t03606436138._1
874+ let burnArtifact = $t03606436138._2
875+ $Tuple2(adjustedFee, burnArtifact)
876+ }
877+ else throw("Strict value is not equal to itself.")
878+ }
879+
880+
881+func getArtifactId (i) = {
882+ let artifactId = if ((size(i.payments) > 1))
883+ then toBase58String(valueOrErrorMessage(i.payments[1].assetId, "Invalid artifactId"))
884+ else ""
885+ artifactId
886+ }
887+
888+
889+func distributeFee (_feeAmount) = {
890+ let feeToStakers = muld(_feeAmount, feeToStakersPercent())
891+ let feeToVault = (_feeAmount - feeToStakers)
892+ $Tuple2(feeToStakers, feeToVault)
893+ }
894+
895+
896+func updateSettings (_initMarginRatio,_mmr,_liquidationFeeRatio,_fundingPeriod,_fee,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread,_maxOpenNotional,_feeToStakersPercent,_maxOracleDelay) = [IntegerEntry(k_initMarginRatio, _initMarginRatio), IntegerEntry(k_maintenanceMarginRatio, _mmr), IntegerEntry(k_liquidationFeeRatio, _liquidationFeeRatio), IntegerEntry(k_fundingPeriod, _fundingPeriod), IntegerEntry(k_fee, _fee), IntegerEntry(k_spreadLimit, _spreadLimit), IntegerEntry(k_maxPriceImpact, _maxPriceImpact), IntegerEntry(k_partialLiquidationRatio, _partialLiquidationRatio), IntegerEntry(k_maxPriceSpread, _maxPriceSpread), IntegerEntry(k_maxOpenNotional, _maxOpenNotional), IntegerEntry(k_feeToStakersPercent, _feeToStakersPercent), IntegerEntry(k_maxOracleDelay, _feeToStakersPercent)]
817897
818898
819899 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)]
820900
821901
822902 func updatePositionAsset (_address,_assetId) = [StringEntry(toCompositeKey(k_positionAsset, _address), _assetId)]
823903
824904
825905 func incrementPositionSequenceNumber (isNewPosition,_address) = if (isNewPosition)
826906 then {
827907 let currentSequence = lastSequence()
828908 [IntegerEntry(toCompositeKey(k_positionSequence, _address), (currentSequence + 1)), IntegerEntry(k_sequence, (currentSequence + 1))]
829909 }
830910 else nil
831911
832912
833913 func updatePosition (_address,_size,_margin,_openNotional,_latestCumulativePremiumFraction) = [IntegerEntry(toCompositeKey(k_positionSize, _address), _size), IntegerEntry(toCompositeKey(k_positionMargin, _address), _margin), IntegerEntry(toCompositeKey(k_positionOpenNotional, _address), _openNotional), IntegerEntry(toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _address), _latestCumulativePremiumFraction)]
834914
835915
836-func appendTwap (price) = {
916+func appendTwap (_price) = {
837917 let minuteId = ((lastBlock.timestamp / 1000) / 60)
838918 let previousMinuteId = valueOrElse(getInteger(this, k_lastMinuteId), 0)
839919 if ((previousMinuteId > minuteId))
840920 then throw("TWAP out-of-order")
841921 else {
842922 let lastMinuteId = if ((previousMinuteId == 0))
843923 then minuteId
844924 else previousMinuteId
845925 if ((minuteId > previousMinuteId))
846926 then {
847927 let prevCumulativePrice = valueOrElse(getInteger(this, ((k_twapDataLastCumulativePrice + "_") + toString(previousMinuteId))), 0)
848- let prevPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(previousMinuteId))), price)
928+ let prevPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(previousMinuteId))), _price)
849929 let lastCumulativePrice = (prevCumulativePrice + ((minuteId - lastMinuteId) * prevPrice))
850930 let list = pushToQueue(strToList(valueOrElse(getString(this, k_lastDataStr), "")), TWAP_INTERVAL, toString(minuteId))
851-[IntegerEntry(toCompositeKey(k_twapDataLastCumulativePrice, toString(minuteId)), lastCumulativePrice), IntegerEntry(toCompositeKey(k_twapDataLastPrice, toString(minuteId)), price), IntegerEntry(toCompositeKey(k_twapDataPreviousMinuteId, toString(minuteId)), previousMinuteId), IntegerEntry(k_lastMinuteId, minuteId), StringEntry(k_lastDataStr, listToStr(list))]
931+[IntegerEntry(toCompositeKey(k_twapDataLastCumulativePrice, toString(minuteId)), lastCumulativePrice), IntegerEntry(toCompositeKey(k_twapDataLastPrice, toString(minuteId)), _price), IntegerEntry(toCompositeKey(k_twapDataPreviousMinuteId, toString(minuteId)), previousMinuteId), IntegerEntry(k_lastMinuteId, minuteId), StringEntry(k_lastDataStr, listToStr(list))]
852932 }
853933 else {
854934 let twapDataPreviousMinuteId = valueOrElse(getInteger(this, toCompositeKey(k_twapDataPreviousMinuteId, toString(minuteId))), 0)
855935 let prevCumulativePrice = valueOrElse(getInteger(this, toCompositeKey(k_twapDataLastCumulativePrice, toString(twapDataPreviousMinuteId))), 0)
856- let prevPrice = valueOrElse(getInteger(this, toCompositeKey(k_twapDataLastPrice, toString(twapDataPreviousMinuteId))), price)
936+ let prevPrice = valueOrElse(getInteger(this, toCompositeKey(k_twapDataLastPrice, toString(twapDataPreviousMinuteId))), _price)
857937 let lastCumulativePrice = (prevCumulativePrice + ((minuteId - twapDataPreviousMinuteId) * prevPrice))
858-[IntegerEntry(toCompositeKey(k_twapDataLastCumulativePrice, toString(minuteId)), lastCumulativePrice), IntegerEntry(toCompositeKey(k_twapDataLastPrice, toString(minuteId)), price)]
938+[IntegerEntry(toCompositeKey(k_twapDataLastCumulativePrice, toString(minuteId)), lastCumulativePrice), IntegerEntry(toCompositeKey(k_twapDataLastPrice, toString(minuteId)), _price)]
859939 }
860940 }
861941 }
862942
863943
864944 func updateAmmReserves (_qtAstR,_bsAstR) = [IntegerEntry(k_quoteAssetReserve, _qtAstR), IntegerEntry(k_baseAssetReserve, _bsAstR)]
865945
866946
867947 func updateAmmWeights (_qtAstW,_bsAstW) = [IntegerEntry(k_quoteAssetWeight, _qtAstW), IntegerEntry(k_baseAssetWeight, _bsAstW)]
868948
869949
870950 func updateAmm (_qtAstR,_bsAstR,_totalPositionSizeAfter,_openInterestNotional,_totalLongPositionSize,_totalShortPositionSize,_totalLongOpenNotional,_totalShortOpenNotional) = {
871951 let _qtAstW = qtAstW()
872952 let _bsAstW = bsAstW()
873953 if (((_totalLongPositionSize - _totalShortPositionSize) != _totalPositionSizeAfter))
874954 then throw(((((("Invalid AMM state data: " + toString(_totalLongPositionSize)) + " + ") + toString(_totalShortPositionSize)) + " != ") + toString(_totalPositionSizeAfter)))
875955 else ((updateAmmReserves(_qtAstR, _bsAstR) ++ [IntegerEntry(k_totalPositionSize, _totalPositionSizeAfter), IntegerEntry(k_openInterestNotional, _openInterestNotional), IntegerEntry(k_totalLongPositionSize, _totalLongPositionSize), IntegerEntry(k_totalShortPositionSize, _totalShortPositionSize), IntegerEntry(k_openInterestLong, _totalLongOpenNotional), IntegerEntry(k_openInterestShort, _totalShortOpenNotional)]) ++ appendTwap(divd(muld(_qtAstR, _qtAstW), muld(_bsAstR, _bsAstW))))
876956 }
877957
878958
879959 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))]
880960
881961
882962 func withdraw (_address,_amount) = {
883963 let balance = assetBalance(this, quoteAsset())
884964 if ((_amount > balance))
885965 then throw(((("Unable to withdraw " + toString(_amount)) + " from contract balance ") + toString(balance)))
886966 else [ScriptTransfer(_address, _amount, quoteAsset())]
887967 }
888968
889969
890970 func updateBalance (i) = if ((0 > i))
891971 then throw("Balance")
892972 else [IntegerEntry(k_balance, i)]
893973
894974
895975 func transferFee (i) = [ScriptTransfer(stakingAddress(), i, quoteAsset())]
896976
897977
898978 func doBurnArtifact (_burnArtifact,i) = if (_burnArtifact)
899979 then [Burn(valueOrErrorMessage(i.payments[1].assetId, "Invalid artifact"), 1)]
900980 else nil
901-
902-
903-func isSameAssetOrNoPosition (_trader,_assetId) = {
904- let oldPositionSize = getPosition(_trader)._1
905- if ((oldPositionSize == 0))
906- then true
907- else (getPositionAsset(_trader) == _assetId)
908- }
909-
910-
911-func isSameAsset (_trader,_assetId) = (getPositionAsset(_trader) == _assetId)
912-
913-
914-func getBorrowedByTraderInMarketKey (_amm,_assetId,_trader) = ((((((k_trader_market_asset_collateral + "_") + _amm) + "_") + _assetId) + "_") + _trader)
915-
916-
917-func getBorrowedByTrader (_trader) = {
918- let positionAsset = getPositionAsset(_trader)
919- if ((positionAsset == toBase58String(quoteAsset())))
920- then $Tuple2(0, positionAsset)
921- else {
922- let key = getBorrowedByTraderInMarketKey(toString(this), positionAsset, _trader)
923- let borrow = valueOrElse(getInteger(collateralAddress(), key), 0)
924- $Tuple2(borrow, positionAsset)
925- }
926- }
927-
928-
929-func getForTraderWithArtifact (_trader,_artifactId) = {
930- let doGetFeeDiscount = invoke(minerAddress(), "computeFeeDiscount", [_trader], nil)
931- if ((doGetFeeDiscount == doGetFeeDiscount))
932- then {
933- let feeDiscount = match doGetFeeDiscount {
934- case x: Int =>
935- x
936- case _ =>
937- throw("Invalid computeFeeDiscount result")
938- }
939- let $t04258342657 = getAdjustedFee(_artifactId, feeDiscount)
940- let adjustedFee = $t04258342657._1
941- let burnArtifact = $t04258342657._2
942- $Tuple2(adjustedFee, burnArtifact)
943- }
944- else throw("Strict value is not equal to itself.")
945- }
946-
947-
948-func getArtifactId (i) = {
949- let artifactId = if ((size(i.payments) > 1))
950- then toBase58String(valueOrErrorMessage(i.payments[1].assetId, "Invalid artifactId"))
951- else ""
952- artifactId
953- }
954981
955982
956983 @Callable(i)
957984 func pause () = if ((i.caller != adminAddress()))
958985 then throw("Invalid pause params")
959986 else [BooleanEntry(k_paused, true)]
960987
961988
962989
963990 @Callable(i)
964991 func unpause () = if ((i.caller != adminAddress()))
965992 then throw("Invalid unpause params")
966993 else [BooleanEntry(k_paused, false)]
967994
968995
969996
970997 @Callable(i)
971998 func setCloseOnly () = if ((i.caller != adminAddress()))
972999 then throw("Invalid setCloseOnly params")
9731000 else [BooleanEntry(k_closeOnly, true)]
9741001
9751002
9761003
9771004 @Callable(i)
9781005 func unsetCloseOnly () = if ((i.caller != adminAddress()))
9791006 then throw("Invalid unsetCloseOnly params")
9801007 else [BooleanEntry(k_closeOnly, false)]
9811008
9821009
9831010
9841011 @Callable(i)
9851012 func addLiquidity (_quoteAssetAmount) = if (if ((i.caller != adminAddress()))
9861013 then true
9871014 else (0 >= _quoteAssetAmount))
9881015 then throw("Invalid addLiquidity params")
9891016 else {
9901017 let _qtAstR = qtAstR()
9911018 let _bsAstR = bsAstR()
9921019 let _qtAstW = qtAstW()
9931020 let _bsAstW = bsAstW()
9941021 let price = divd(muld(_qtAstR, _qtAstW), muld(_bsAstR, _bsAstW))
9951022 let baseAssetAmountToAdd = divd(_quoteAssetAmount, price)
9961023 let qtAstRAfter = (_qtAstR + _quoteAssetAmount)
9971024 let bsAstRAfter = (_bsAstR + baseAssetAmountToAdd)
9981025 updateAmmReserves(qtAstRAfter, bsAstRAfter)
9991026 }
10001027
10011028
10021029
10031030 @Callable(i)
10041031 func removeLiquidity (_quoteAssetAmount) = if (if ((i.caller != adminAddress()))
10051032 then true
10061033 else (0 >= _quoteAssetAmount))
10071034 then throw("Invalid removeLiquidity params")
10081035 else {
10091036 let _qtAstR = qtAstR()
10101037 let _bsAstR = bsAstR()
10111038 let _qtAstW = qtAstW()
10121039 let _bsAstW = bsAstW()
10131040 let price = divd(muld(_qtAstR, _qtAstW), muld(_bsAstR, _bsAstW))
10141041 let baseAssetAmountToRemove = divd(_quoteAssetAmount, price)
10151042 let qtAstRAfter = (_qtAstR - _quoteAssetAmount)
10161043 let bsAstRAfter = (_bsAstR - baseAssetAmountToRemove)
10171044 updateAmmReserves(qtAstRAfter, bsAstRAfter)
10181045 }
10191046
10201047
10211048
10221049 @Callable(i)
1023-func changeSettings (_initMarginRatio,_mmr,_liquidationFeeRatio,_fundingPeriod,_fee,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread,_maxOpenNotional) = if ((i.caller != adminAddress()))
1050+func changeSettings (_initMarginRatio,_mmr,_liquidationFeeRatio,_fundingPeriod,_fee,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread,_maxOpenNotional,_feeToStakersPercent,_maxOracleDelay) = if ((i.caller != adminAddress()))
10241051 then throw("Invalid changeSettings params")
1025- else updateSettings(_initMarginRatio, _mmr, _liquidationFeeRatio, _fundingPeriod, _fee, _spreadLimit, _maxPriceImpact, _partialLiquidationRatio, _maxPriceSpread, _maxOpenNotional)
1026-
1027-
1028-
1029-@Callable(i)
1030-func initialize (_qtAstR,_bsAstR,_fundingPeriod,_initMarginRatio,_mmr,_liquidationFeeRatio,_fee,_oracle,_oracleKey,_coordinator,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread,_maxOpenNotional) = if (if (if (if (if (if (if (if (if (if (if (if (if ((0 >= _qtAstR))
1052+ else updateSettings(_initMarginRatio, _mmr, _liquidationFeeRatio, _fundingPeriod, _fee, _spreadLimit, _maxPriceImpact, _partialLiquidationRatio, _maxPriceSpread, _maxOpenNotional, _feeToStakersPercent, _maxOracleDelay)
1053+
1054+
1055+
1056+@Callable(i)
1057+func initialize (_qtAstR,_bsAstR,_fundingPeriod,_initMarginRatio,_mmr,_liquidationFeeRatio,_fee,_oracle,_oracleKey,_oracleBlockKey,_coordinator,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread,_maxOpenNotional,_feeToStakersPercent,_maxOracleDelay) = if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if ((0 >= _qtAstR))
10311058 then true
10321059 else (0 >= _bsAstR))
10331060 then true
10341061 else (0 >= _fundingPeriod))
10351062 then true
10361063 else (0 >= _initMarginRatio))
10371064 then true
10381065 else (0 >= _mmr))
10391066 then true
10401067 else (0 >= _liquidationFeeRatio))
10411068 then true
10421069 else (0 >= _fee))
10431070 then true
10441071 else (0 >= _spreadLimit))
10451072 then true
10461073 else (0 >= _maxPriceImpact))
10471074 then true
10481075 else (0 >= _partialLiquidationRatio))
10491076 then true
10501077 else (0 >= _maxPriceSpread))
10511078 then true
10521079 else (0 >= _maxOpenNotional))
10531080 then true
1081+ else (0 >= _feeToStakersPercent))
1082+ then true
1083+ else (_feeToStakersPercent > DECIMAL_UNIT))
1084+ then true
1085+ else (0 >= _maxOracleDelay))
1086+ then true
10541087 else initialized())
10551088 then throw("Invalid initialize parameters")
1056- else ((((updateAmm(_qtAstR, _bsAstR, 0, 0, 0, 0, 0, 0) ++ updateSettings(_initMarginRatio, _mmr, _liquidationFeeRatio, _fundingPeriod, _fee, _spreadLimit, _maxPriceImpact, _partialLiquidationRatio, _maxPriceSpread, _maxOpenNotional)) ++ updateFunding((lastBlock.timestamp + _fundingPeriod), 0, 0, 0, 0)) ++ updateBalance(0)) ++ [BooleanEntry(k_initialized, true), StringEntry(k_ora, _oracle), StringEntry(k_ora_key, _oracleKey), StringEntry(k_coordinatorAddress, _coordinator)])
1089+ else ((((updateAmm(_qtAstR, _bsAstR, 0, 0, 0, 0, 0, 0) ++ updateSettings(_initMarginRatio, _mmr, _liquidationFeeRatio, _fundingPeriod, _fee, _spreadLimit, _maxPriceImpact, _partialLiquidationRatio, _maxPriceSpread, _maxOpenNotional, _feeToStakersPercent, _maxOracleDelay)) ++ updateFunding((lastBlock.timestamp + _fundingPeriod), 0, 0, 0, 0)) ++ updateBalance(0)) ++ [BooleanEntry(k_initialized, true), StringEntry(k_ora, _oracle), StringEntry(k_ora_key, _oracleKey), StringEntry(k_ora_block_key, _oracleBlockKey), StringEntry(k_coordinatorAddress, _coordinator)])
10571090
10581091
10591092
10601093 @Callable(i)
10611094 func decreasePosition (_amount,_leverage,_minBaseAssetAmount) = {
10621095 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
10631096 if ((sync == sync))
10641097 then {
10651098 let _trader = getActualCaller(i)
10661099 if (if (if (if (if ((0 >= _amount))
10671100 then true
10681101 else !(initialized()))
10691102 then true
10701103 else !(requireMoreMarginRatio(divd(DECIMAL_UNIT, _leverage), initMarginRatio(), true)))
10711104 then true
10721105 else !(requireOpenPosition(_trader)))
10731106 then true
10741107 else paused())
10751108 then throw("Invalid decreasePosition parameters")
10761109 else {
1077- let $t04734747487 = getPosition(_trader)
1078- let oldPositionSize = $t04734747487._1
1079- let oldPositionMargin = $t04734747487._2
1080- let oldPositionOpenNotional = $t04734747487._3
1081- let oldPositionLstUpdCPF = $t04734747487._4
1110+ let $t04867748817 = getPosition(_trader)
1111+ let oldPositionSize = $t04867748817._1
1112+ let oldPositionMargin = $t04867748817._2
1113+ let oldPositionOpenNotional = $t04867748817._3
1114+ let oldPositionLstUpdCPF = $t04867748817._4
10821115 let _direction = if ((oldPositionSize > 0))
10831116 then DIR_SHORT
10841117 else DIR_LONG
10851118 let isAdd = (_direction == DIR_LONG)
10861119 let openNotional = muld(_amount, _leverage)
1087- let $t04766047764 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1088- let oldPositionNotional = $t04766047764._1
1089- let unrealizedPnl = $t04766047764._2
1090- let $t04777050428 = if ((oldPositionNotional > openNotional))
1120+ let $t04899049094 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1121+ let oldPositionNotional = $t04899049094._1
1122+ let unrealizedPnl = $t04899049094._2
1123+ let $t04910051758 = if ((oldPositionNotional > openNotional))
10911124 then {
1092- let $t04818548369 = swapInput(isAdd, openNotional)
1093- let exchangedPositionSize = $t04818548369._1
1094- let quoteAssetReserveAfter = $t04818548369._2
1095- let baseAssetReserveAfter = $t04818548369._3
1096- let totalPositionSizeAfter = $t04818548369._4
1125+ let $t04951549699 = swapInput(isAdd, openNotional)
1126+ let exchangedPositionSize = $t04951549699._1
1127+ let quoteAssetReserveAfter = $t04951549699._2
1128+ let baseAssetReserveAfter = $t04951549699._3
1129+ let totalPositionSizeAfter = $t04951549699._4
10971130 let exchangedPositionSizeAbs = abs(exchangedPositionSize)
10981131 if (if ((_minBaseAssetAmount != 0))
10991132 then (_minBaseAssetAmount > exchangedPositionSizeAbs)
11001133 else false)
11011134 then throw(((("Too little base asset exchanged, got " + toString(exchangedPositionSizeAbs)) + " expected ") + toString(_minBaseAssetAmount)))
11021135 else {
11031136 let realizedPnl = divd(muld(unrealizedPnl, exchangedPositionSizeAbs), abs(oldPositionSize))
1104- let $t04880649051 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl)
1105- let remainMargin = $t04880649051._1
1106- let badDebt = $t04880649051._2
1107- let fundingPayment = $t04880649051._3
1137+ let $t05013650381 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl)
1138+ let remainMargin = $t05013650381._1
1139+ let badDebt = $t05013650381._2
1140+ let fundingPayment = $t05013650381._3
11081141 let exchangedQuoteAssetAmount = openNotional
11091142 let unrealizedPnlAfter = (unrealizedPnl - realizedPnl)
11101143 let remainOpenNotional = if ((oldPositionSize > 0))
11111144 then ((oldPositionNotional - exchangedQuoteAssetAmount) - unrealizedPnlAfter)
11121145 else ((unrealizedPnlAfter + oldPositionNotional) - exchangedQuoteAssetAmount)
11131146 let newPositionSize = (oldPositionSize + exchangedPositionSize)
11141147 $Tuple12(newPositionSize, remainMargin, abs(remainOpenNotional), latestCumulativePremiumFraction(newPositionSize), baseAssetReserveAfter, quoteAssetReserveAfter, totalPositionSizeAfter, (openInterestNotional() - openNotional), (totalLongPositionSize() - (if ((newPositionSize > 0))
11151148 then abs(exchangedPositionSize)
11161149 else 0)), (totalShortPositionSize() - (if ((0 > newPositionSize))
11171150 then abs(exchangedPositionSize)
11181151 else 0)), (openInterestLong() - (if ((newPositionSize > 0))
11191152 then openNotional
11201153 else 0)), (openInterestShort() - (if ((0 > newPositionSize))
11211154 then openNotional
11221155 else 0)))
11231156 }
11241157 }
11251158 else throw("Close position first")
1126- let newPositionSize = $t04777050428._1
1127- let newPositionRemainMargin = $t04777050428._2
1128- let newPositionOpenNotional = $t04777050428._3
1129- let newPositionLatestCPF = $t04777050428._4
1130- let baseAssetReserveAfter = $t04777050428._5
1131- let quoteAssetReserveAfter = $t04777050428._6
1132- let totalPositionSizeAfter = $t04777050428._7
1133- let openInterestNotionalAfter = $t04777050428._8
1134- let totalLongAfter = $t04777050428._9
1135- let totalShortAfter = $t04777050428._10
1136- let totalLongOpenInterestAfter = $t04777050428._11
1137- let totalShortOpenInterestAfter = $t04777050428._12
1159+ let newPositionSize = $t04910051758._1
1160+ let newPositionRemainMargin = $t04910051758._2
1161+ let newPositionOpenNotional = $t04910051758._3
1162+ let newPositionLatestCPF = $t04910051758._4
1163+ let baseAssetReserveAfter = $t04910051758._5
1164+ let quoteAssetReserveAfter = $t04910051758._6
1165+ let totalPositionSizeAfter = $t04910051758._7
1166+ let openInterestNotionalAfter = $t04910051758._8
1167+ let totalLongAfter = $t04910051758._9
1168+ let totalShortAfter = $t04910051758._10
1169+ let totalLongOpenInterestAfter = $t04910051758._11
1170+ let totalShortOpenInterestAfter = $t04910051758._12
11381171 let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, newPositionOpenNotional], nil)
11391172 if ((notifyNotional == notifyNotional))
11401173 then (updatePosition(_trader, newPositionSize, newPositionRemainMargin, newPositionOpenNotional, newPositionLatestCPF) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter))
11411174 else throw("Strict value is not equal to itself.")
11421175 }
11431176 }
11441177 else throw("Strict value is not equal to itself.")
11451178 }
11461179
11471180
11481181
11491182 @Callable(i)
11501183 func increasePosition (_direction,_leverage,_minBaseAssetAmount,_refLink) = {
11511184 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
11521185 if ((sync == sync))
11531186 then {
11541187 let _trader = getActualCaller(i)
11551188 let _rawAmount = i.payments[0].amount
11561189 let _assetId = i.payments[0].assetId
11571190 let _assetIdStr = toBase58String(value(_assetId))
11581191 let isQuoteAsset = (_assetId == quoteAsset())
11591192 let isCollateralAsset = isWhitelistAsset(_assetIdStr)
11601193 if (if (if (if (if (if (if (if (if ((_direction != DIR_LONG))
11611194 then (_direction != DIR_SHORT)
11621195 else false)
11631196 then true
11641197 else (0 >= _rawAmount))
11651198 then true
11661199 else !(initialized()))
11671200 then true
11681201 else if (!(isQuoteAsset))
11691202 then !(isCollateralAsset)
11701203 else false)
11711204 then true
11721205 else !(isSameAssetOrNoPosition(_trader, _assetIdStr)))
11731206 then true
11741207 else !(requireMoreMarginRatio(divd(DECIMAL_UNIT, _leverage), initMarginRatio(), true)))
11751208 then true
11761209 else paused())
11771210 then true
11781211 else closeOnly())
11791212 then throw("Invalid increasePosition parameters")
11801213 else {
1181- let $t05186651951 = getForTraderWithArtifact(_trader, getArtifactId(i))
1182- let adjustedFee = $t05186651951._1
1183- let burnArtifact = $t05186651951._2
1214+ let $t05319653281 = getForTraderWithArtifact(_trader, getArtifactId(i))
1215+ let adjustedFee = $t05319653281._1
1216+ let burnArtifact = $t05319653281._2
11841217 let rawFeeAmount = muld(_rawAmount, adjustedFee)
11851218 let _amount = (_rawAmount - rawFeeAmount)
11861219 let distributeFeeAmount = if (isCollateralAsset)
11871220 then {
11881221 let doBorrow = invoke(collateralAddress(), "borrow", [_trader], [AttachedPayment(_assetId, _amount)])
11891222 if ((doBorrow == doBorrow))
11901223 then {
11911224 let balanceBefore = assetBalance(this, quoteAsset())
11921225 if ((balanceBefore == balanceBefore))
11931226 then {
11941227 let doSwap = invoke(swapAddress(), "swap", [toBase58String(quoteAsset()), 0], [AttachedPayment(_assetId, rawFeeAmount)])
11951228 if ((doSwap == doSwap))
11961229 then {
11971230 let balanceAfter = assetBalance(this, quoteAsset())
11981231 if ((balanceAfter == balanceAfter))
11991232 then {
12001233 let exchangedAmount = (balanceAfter - balanceBefore)
12011234 if ((exchangedAmount == exchangedAmount))
12021235 then exchangedAmount
12031236 else throw("Strict value is not equal to itself.")
12041237 }
12051238 else throw("Strict value is not equal to itself.")
12061239 }
12071240 else throw("Strict value is not equal to itself.")
12081241 }
12091242 else throw("Strict value is not equal to itself.")
12101243 }
12111244 else throw("Strict value is not equal to itself.")
12121245 }
12131246 else rawFeeAmount
12141247 if ((distributeFeeAmount == distributeFeeAmount))
12151248 then {
12161249 let referrerFeeAny = invoke(referralAddress(), "acceptPaymentWithLink", [_trader, _refLink], [AttachedPayment(quoteAsset(), distributeFeeAmount)])
12171250 if ((referrerFeeAny == referrerFeeAny))
12181251 then {
12191252 let referrerFee = match referrerFeeAny {
12201253 case x: Int =>
12211254 x
12221255 case _ =>
12231256 throw("Invalid referrerFee")
12241257 }
12251258 let feeAmount = (distributeFeeAmount - referrerFee)
1226- let $t05326753407 = getPosition(_trader)
1227- let oldPositionSize = $t05326753407._1
1228- let oldPositionMargin = $t05326753407._2
1229- let oldPositionOpenNotional = $t05326753407._3
1230- let oldPositionLstUpdCPF = $t05326753407._4
1259+ let $t05459754737 = getPosition(_trader)
1260+ let oldPositionSize = $t05459754737._1
1261+ let oldPositionMargin = $t05459754737._2
1262+ let oldPositionOpenNotional = $t05459754737._3
1263+ let oldPositionLstUpdCPF = $t05459754737._4
12311264 let isNewPosition = (oldPositionSize == 0)
12321265 let isSameDirection = if ((oldPositionSize > 0))
12331266 then (_direction == DIR_LONG)
12341267 else (_direction == DIR_SHORT)
12351268 let expandExisting = if (!(isNewPosition))
12361269 then isSameDirection
12371270 else false
12381271 let isAdd = (_direction == DIR_LONG)
1239- let $t05369656737 = if (if (isNewPosition)
1272+ let $t05502658067 = if (if (isNewPosition)
12401273 then true
12411274 else expandExisting)
12421275 then {
12431276 let openNotional = muld(_amount, _leverage)
1244- let $t05415854331 = swapInput(isAdd, openNotional)
1245- let amountBaseAssetBought = $t05415854331._1
1246- let quoteAssetReserveAfter = $t05415854331._2
1247- let baseAssetReserveAfter = $t05415854331._3
1248- let totalPositionSizeAfter = $t05415854331._4
1277+ let $t05548855661 = swapInput(isAdd, openNotional)
1278+ let amountBaseAssetBought = $t05548855661._1
1279+ let quoteAssetReserveAfter = $t05548855661._2
1280+ let baseAssetReserveAfter = $t05548855661._3
1281+ let totalPositionSizeAfter = $t05548855661._4
12491282 if (if ((_minBaseAssetAmount != 0))
12501283 then (_minBaseAssetAmount > abs(amountBaseAssetBought))
12511284 else false)
12521285 then throw(((("Limit error: " + toString(abs(amountBaseAssetBought))) + " < ") + toString(_minBaseAssetAmount)))
12531286 else {
12541287 let newPositionSize = (oldPositionSize + amountBaseAssetBought)
12551288 let totalLongOpenInterestAfter = (openInterestLong() + (if ((newPositionSize > 0))
12561289 then openNotional
12571290 else 0))
12581291 let totalShortOpenInterestAfter = (openInterestShort() + (if ((0 > newPositionSize))
12591292 then openNotional
12601293 else 0))
12611294 let increaseMarginRequirement = divd(openNotional, _leverage)
1262- let $t05493955178 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, increaseMarginRequirement)
1263- let remainMargin = $t05493955178._1
1264- let x1 = $t05493955178._2
1265- let x2 = $t05493955178._3
1295+ let $t05626956508 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, increaseMarginRequirement)
1296+ let remainMargin = $t05626956508._1
1297+ let x1 = $t05626956508._2
1298+ let x2 = $t05626956508._3
12661299 if (!(requireNotOverSpreadLimit(quoteAssetReserveAfter, baseAssetReserveAfter)))
12671300 then throw("Over max spread limit")
12681301 else if (!(requireNotOverMaxOpenNotional(totalLongOpenInterestAfter, totalShortOpenInterestAfter)))
12691302 then throw("Over max open notional")
12701303 else $Tuple12(newPositionSize, remainMargin, (oldPositionOpenNotional + openNotional), latestCumulativePremiumFraction(newPositionSize), baseAssetReserveAfter, quoteAssetReserveAfter, totalPositionSizeAfter, (openInterestNotional() + openNotional), (totalLongPositionSize() + (if ((newPositionSize > 0))
12711304 then abs(amountBaseAssetBought)
12721305 else 0)), (totalShortPositionSize() + (if ((0 > newPositionSize))
12731306 then abs(amountBaseAssetBought)
12741307 else 0)), totalLongOpenInterestAfter, totalShortOpenInterestAfter)
12751308 }
12761309 }
12771310 else {
12781311 let openNotional = muld(_amount, _leverage)
1279- let $t05643756553 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT)
1280- let oldPositionNotional = $t05643756553._1
1281- let unrealizedPnl = $t05643756553._2
1312+ let $t05776757883 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT)
1313+ let oldPositionNotional = $t05776757883._1
1314+ let unrealizedPnl = $t05776757883._2
12821315 if ((oldPositionNotional > openNotional))
12831316 then throw("Use decreasePosition to decrease position size")
12841317 else throw("Close position first")
12851318 }
1286- let newPositionSize = $t05369656737._1
1287- let newPositionRemainMargin = $t05369656737._2
1288- let newPositionOpenNotional = $t05369656737._3
1289- let newPositionLatestCPF = $t05369656737._4
1290- let baseAssetReserveAfter = $t05369656737._5
1291- let quoteAssetReserveAfter = $t05369656737._6
1292- let totalPositionSizeAfter = $t05369656737._7
1293- let openInterestNotionalAfter = $t05369656737._8
1294- let totalLongAfter = $t05369656737._9
1295- let totalShortAfter = $t05369656737._10
1296- let totalLongOpenInterestAfter = $t05369656737._11
1297- let totalShortOpenInterestAfter = $t05369656737._12
1298- let feeToStakers = (feeAmount / 2)
1299- let feeToInsurance = (feeAmount - feeToStakers)
1300- let stake = invoke(vaultAddress(), "addLocked", nil, [AttachedPayment(quoteAsset(), _amount)])
1319+ let newPositionSize = $t05502658067._1
1320+ let newPositionRemainMargin = $t05502658067._2
1321+ let newPositionOpenNotional = $t05502658067._3
1322+ let newPositionLatestCPF = $t05502658067._4
1323+ let baseAssetReserveAfter = $t05502658067._5
1324+ let quoteAssetReserveAfter = $t05502658067._6
1325+ let totalPositionSizeAfter = $t05502658067._7
1326+ let openInterestNotionalAfter = $t05502658067._8
1327+ let totalLongAfter = $t05502658067._9
1328+ let totalShortAfter = $t05502658067._10
1329+ let totalLongOpenInterestAfter = $t05502658067._11
1330+ let totalShortOpenInterestAfter = $t05502658067._12
1331+ let $t05807358130 = distributeFee(feeAmount)
1332+ let feeToStakers = $t05807358130._1
1333+ let feeToVault = $t05807358130._2
1334+ let stake = if (isQuoteAsset)
1335+ then {
1336+ let stake = invoke(vaultAddress(), "addLocked", [false], [AttachedPayment(quoteAsset(), _amount)])
1337+ if ((stake == stake))
1338+ then nil
1339+ else throw("Strict value is not equal to itself.")
1340+ }
1341+ else nil
13011342 if ((stake == stake))
13021343 then {
1303- let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToInsurance)])
1344+ let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)])
13041345 if ((depositInsurance == depositInsurance))
13051346 then {
13061347 let notifyFee = invoke(minerAddress(), "notifyFees", [_trader, feeAmount], nil)
13071348 if ((notifyFee == notifyFee))
13081349 then {
13091350 let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, newPositionOpenNotional], nil)
13101351 if ((notifyNotional == notifyNotional))
13111352 then ((((((updatePosition(_trader, newPositionSize, newPositionRemainMargin, newPositionOpenNotional, newPositionLatestCPF) ++ incrementPositionSequenceNumber(isNewPosition, _trader)) ++ updatePositionAsset(_trader, _assetIdStr)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)) ++ transferFee(feeToStakers)) ++ updateBalance((cbalance() + _amount))) ++ doBurnArtifact(burnArtifact, i))
13121353 else throw("Strict value is not equal to itself.")
13131354 }
13141355 else throw("Strict value is not equal to itself.")
13151356 }
13161357 else throw("Strict value is not equal to itself.")
13171358 }
13181359 else throw("Strict value is not equal to itself.")
13191360 }
13201361 else throw("Strict value is not equal to itself.")
13211362 }
13221363 else throw("Strict value is not equal to itself.")
13231364 }
13241365 }
13251366 else throw("Strict value is not equal to itself.")
13261367 }
13271368
13281369
13291370
13301371 @Callable(i)
13311372 func addMargin () = {
13321373 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
13331374 if ((sync == sync))
13341375 then {
13351376 let _trader = toString(i.caller)
13361377 let _rawAmount = i.payments[0].amount
13371378 let _assetId = i.payments[0].assetId
13381379 let _assetIdStr = toBase58String(value(_assetId))
13391380 let isQuoteAsset = (_assetId == quoteAsset())
13401381 let isCollateralAsset = isWhitelistAsset(_assetIdStr)
13411382 if (if (if (if (if (if (if (!(isQuoteAsset))
13421383 then !(isCollateralAsset)
13431384 else false)
13441385 then true
13451386 else !(requireOpenPosition(toString(i.caller))))
13461387 then true
13471388 else !(isSameAsset(_trader, _assetIdStr)))
13481389 then true
13491390 else !(initialized()))
13501391 then true
13511392 else paused())
13521393 then true
13531394 else closeOnly())
13541395 then throw("Invalid addMargin parameters")
13551396 else {
1356- let $t05867958764 = getForTraderWithArtifact(_trader, getArtifactId(i))
1357- let adjustedFee = $t05867958764._1
1358- let burnArtifact = $t05867958764._2
1397+ let $t06007860163 = getForTraderWithArtifact(_trader, getArtifactId(i))
1398+ let adjustedFee = $t06007860163._1
1399+ let burnArtifact = $t06007860163._2
13591400 let rawFeeAmount = muld(_rawAmount, adjustedFee)
13601401 let _amount = (_rawAmount - rawFeeAmount)
13611402 let distributeFeeAmount = if (isCollateralAsset)
13621403 then {
13631404 let doBorrow = invoke(collateralAddress(), "borrow", [_trader], [AttachedPayment(_assetId, _amount)])
13641405 if ((doBorrow == doBorrow))
13651406 then {
13661407 let balanceBefore = assetBalance(this, quoteAsset())
13671408 if ((balanceBefore == balanceBefore))
13681409 then {
13691410 let doSwap = invoke(swapAddress(), "swap", [toBase58String(quoteAsset()), 0], [AttachedPayment(_assetId, rawFeeAmount)])
13701411 if ((doSwap == doSwap))
13711412 then {
13721413 let balanceAfter = assetBalance(this, quoteAsset())
13731414 if ((balanceAfter == balanceAfter))
13741415 then {
13751416 let exchangedAmount = (balanceAfter - balanceBefore)
13761417 if ((exchangedAmount == exchangedAmount))
13771418 then exchangedAmount
13781419 else throw("Strict value is not equal to itself.")
13791420 }
13801421 else throw("Strict value is not equal to itself.")
13811422 }
13821423 else throw("Strict value is not equal to itself.")
13831424 }
13841425 else throw("Strict value is not equal to itself.")
13851426 }
13861427 else throw("Strict value is not equal to itself.")
13871428 }
13881429 else rawFeeAmount
13891430 if ((distributeFeeAmount == distributeFeeAmount))
13901431 then {
13911432 let referrerFeeAny = invoke(referralAddress(), "acceptPayment", [_trader], [AttachedPayment(quoteAsset(), distributeFeeAmount)])
13921433 if ((referrerFeeAny == referrerFeeAny))
13931434 then {
13941435 let referrerFee = match referrerFeeAny {
13951436 case x: Int =>
13961437 x
13971438 case _ =>
13981439 throw("Invalid referrerFee")
13991440 }
14001441 let feeAmount = (distributeFeeAmount - referrerFee)
1401- let $t06006360203 = getPosition(_trader)
1402- let oldPositionSize = $t06006360203._1
1403- let oldPositionMargin = $t06006360203._2
1404- let oldPositionOpenNotional = $t06006360203._3
1405- let oldPositionLstUpdCPF = $t06006360203._4
1406- let feeToStakers = (feeAmount / 2)
1407- let feeToInsurance = (feeAmount - feeToStakers)
1408- let stake = invoke(vaultAddress(), "addLocked", nil, [AttachedPayment(quoteAsset(), _amount)])
1442+ let $t06146261602 = getPosition(_trader)
1443+ let oldPositionSize = $t06146261602._1
1444+ let oldPositionMargin = $t06146261602._2
1445+ let oldPositionOpenNotional = $t06146261602._3
1446+ let oldPositionLstUpdCPF = $t06146261602._4
1447+ let $t06160861665 = distributeFee(feeAmount)
1448+ let feeToStakers = $t06160861665._1
1449+ let feeToVault = $t06160861665._2
1450+ let stake = if (isQuoteAsset)
1451+ then {
1452+ let stake = invoke(vaultAddress(), "addLocked", [false], [AttachedPayment(quoteAsset(), _amount)])
1453+ if ((stake == stake))
1454+ then nil
1455+ else throw("Strict value is not equal to itself.")
1456+ }
1457+ else nil
14091458 if ((stake == stake))
14101459 then {
1411- let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToInsurance)])
1460+ let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)])
14121461 if ((depositInsurance == depositInsurance))
14131462 then {
14141463 let notifyFee = invoke(minerAddress(), "notifyFees", [_trader, feeAmount], nil)
14151464 if ((notifyFee == notifyFee))
14161465 then (((updatePosition(_trader, oldPositionSize, (oldPositionMargin + _amount), oldPositionOpenNotional, oldPositionLstUpdCPF) ++ transferFee(feeToStakers)) ++ updateBalance((cbalance() + _amount))) ++ doBurnArtifact(burnArtifact, i))
14171466 else throw("Strict value is not equal to itself.")
14181467 }
14191468 else throw("Strict value is not equal to itself.")
14201469 }
14211470 else throw("Strict value is not equal to itself.")
14221471 }
14231472 else throw("Strict value is not equal to itself.")
14241473 }
14251474 else throw("Strict value is not equal to itself.")
14261475 }
14271476 }
14281477 else throw("Strict value is not equal to itself.")
14291478 }
14301479
14311480
14321481
14331482 @Callable(i)
14341483 func removeMargin (_amount) = {
14351484 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
14361485 if ((sync == sync))
14371486 then {
14381487 let _trader = toString(i.caller)
14391488 if (if (if (if ((0 >= _amount))
14401489 then true
14411490 else !(requireOpenPosition(_trader)))
14421491 then true
14431492 else !(initialized()))
14441493 then true
14451494 else paused())
14461495 then throw("Invalid removeMargin parameters")
14471496 else {
1448- let $t06130961449 = getPosition(_trader)
1449- let oldPositionSize = $t06130961449._1
1450- let oldPositionMargin = $t06130961449._2
1451- let oldPositionOpenNotional = $t06130961449._3
1452- let oldPositionLstUpdCPF = $t06130961449._4
1497+ let $t06277762917 = getPosition(_trader)
1498+ let oldPositionSize = $t06277762917._1
1499+ let oldPositionMargin = $t06277762917._2
1500+ let oldPositionOpenNotional = $t06277762917._3
1501+ let oldPositionLstUpdCPF = $t06277762917._4
14531502 let marginDelta = -(_amount)
1454- let $t06148661665 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, marginDelta)
1455- let remainMargin = $t06148661665._1
1456- let badDebt = $t06148661665._2
1503+ let $t06295463133 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, marginDelta)
1504+ let remainMargin = $t06295463133._1
1505+ let badDebt = $t06295463133._2
14571506 if ((badDebt != 0))
14581507 then throw("Invalid removed margin amount")
14591508 else {
14601509 let marginRatio = calcMarginRatio(remainMargin, badDebt, oldPositionOpenNotional)
14611510 if (!(requireMoreMarginRatio(marginRatio, initMarginRatio(), true)))
14621511 then throw(((("Too much margin removed: " + toString(marginRatio)) + " < ") + toString(initMarginRatio())))
14631512 else {
14641513 let quoteAssetStr = toBase58String(quoteAsset())
1465- let $t06210962163 = getBorrowedByTrader(_trader)
1466- let borrowed = $t06210962163._1
1467- let assetId = $t06210962163._2
1514+ let $t06357763631 = getBorrowedByTrader(_trader)
1515+ let borrowed = $t06357763631._1
1516+ let assetId = $t06357763631._2
14681517 let toRepay = if ((_amount > borrowed))
14691518 then borrowed
14701519 else _amount
14711520 let toWithdraw = if ((borrowed > _amount))
14721521 then 0
14731522 else (_amount - borrowed)
14741523 let finalBorrow = (borrowed - toRepay)
14751524 let switchPositionToQuote = if ((finalBorrow > 0))
14761525 then nil
14771526 else updatePositionAsset(_trader, quoteAssetStr)
14781527 let doSanityCheck = if (((toRepay + toWithdraw) != _amount))
14791528 then throw(((((("toRepay=" + toString(toRepay)) + " + toWithdraw=") + toString(toWithdraw)) + " != ") + toString(_amount)))
14801529 else nil
14811530 if ((doSanityCheck == doSanityCheck))
14821531 then {
1483- let doUnstake = invoke(vaultAddress(), "withdrawLocked", [_amount], nil)
1532+ let doUnstake = if ((toWithdraw > 0))
1533+ then {
1534+ let doUnstake = invoke(vaultAddress(), "withdrawLocked", [toWithdraw], nil)
1535+ if ((doUnstake == doUnstake))
1536+ then nil
1537+ else throw("Strict value is not equal to itself.")
1538+ }
1539+ else nil
14841540 if ((doUnstake == doUnstake))
14851541 then {
14861542 let returnCollateralAction = if ((toRepay > 0))
14871543 then {
1488- let doRepay = invoke(collateralAddress(), "repay", [_trader, assetId], [AttachedPayment(quoteAsset(), toRepay)])
1544+ let doRepay = invoke(collateralAddress(), "repay", [_trader, toRepay, assetId], nil)
14891545 if ((doRepay == doRepay))
14901546 then [ScriptTransfer(i.caller, toRepay, fromBase58String(assetId))]
14911547 else throw("Strict value is not equal to itself.")
14921548 }
14931549 else nil
14941550 if ((returnCollateralAction == returnCollateralAction))
14951551 then ((((updatePosition(_trader, oldPositionSize, remainMargin, oldPositionOpenNotional, latestCumulativePremiumFraction(oldPositionSize)) ++ (if ((toWithdraw > 0))
14961552 then withdraw(i.caller, toWithdraw)
14971553 else nil)) ++ updateBalance((cbalance() - _amount))) ++ switchPositionToQuote) ++ returnCollateralAction)
14981554 else throw("Strict value is not equal to itself.")
14991555 }
15001556 else throw("Strict value is not equal to itself.")
15011557 }
15021558 else throw("Strict value is not equal to itself.")
15031559 }
15041560 }
15051561 }
15061562 }
15071563 else throw("Strict value is not equal to itself.")
15081564 }
15091565
15101566
15111567
15121568 @Callable(i)
15131569 func closePosition (_size,_minQuoteAssetAmount) = {
15141570 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
15151571 if ((sync == sync))
15161572 then {
15171573 let _trader = getActualCaller(i)
15181574 let _traderAddress = valueOrErrorMessage(addressFromString(_trader), "Invalid caller")
15191575 if (if (if (if (if (!(requireOpenPosition(_trader)))
15201576 then true
15211577 else !(initialized()))
15221578 then true
15231579 else paused())
15241580 then true
15251581 else (0 >= _size))
15261582 then true
15271583 else (0 > _minQuoteAssetAmount))
15281584 then throw("Invalid closePosition parameters")
15291585 else {
1530- let $t06429364433 = getPosition(_trader)
1531- let oldPositionSize = $t06429364433._1
1532- let oldPositionMargin = $t06429364433._2
1533- let oldPositionOpenNotional = $t06429364433._3
1534- let oldPositionLstUpdCPF = $t06429364433._4
1535- let $t06443968811 = if ((abs(oldPositionSize) > _size))
1586+ let $t06578965929 = getPosition(_trader)
1587+ let oldPositionSize = $t06578965929._1
1588+ let oldPositionMargin = $t06578965929._2
1589+ let oldPositionOpenNotional = $t06578965929._3
1590+ let oldPositionLstUpdCPF = $t06578965929._4
1591+ let $t06593570372 = if ((abs(oldPositionSize) > _size))
15361592 then {
15371593 let _direction = if ((oldPositionSize > 0))
15381594 then DIR_SHORT
15391595 else DIR_LONG
15401596 let isAdd = (_direction == DIR_LONG)
1541- let $t06503065252 = swapOutput((oldPositionSize > 0), _size, true)
1542- let exchangedQuoteAssetAmount = $t06503065252._1
1543- let quoteAssetReserveAfter = $t06503065252._2
1544- let baseAssetReserveAfter = $t06503065252._3
1545- let totalPositionSizeAfter = $t06503065252._4
1597+ let $t06652666748 = swapOutput((oldPositionSize > 0), _size, true)
1598+ let exchangedQuoteAssetAmount = $t06652666748._1
1599+ let quoteAssetReserveAfter = $t06652666748._2
1600+ let baseAssetReserveAfter = $t06652666748._3
1601+ let totalPositionSizeAfter = $t06652666748._4
15461602 let exchangedPositionSize = if ((oldPositionSize > 0))
15471603 then -(_size)
15481604 else _size
1549- let $t06534365497 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1550- let oldPositionNotional = $t06534365497._1
1551- let unrealizedPnl = $t06534365497._2
1605+ let $t06683966993 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1606+ let oldPositionNotional = $t06683966993._1
1607+ let unrealizedPnl = $t06683966993._2
1608+ let mr = getMarginRatioByOption(_trader, PNL_OPTION_SPOT)
15521609 let realizedRatio = divd(abs(exchangedPositionSize), abs(oldPositionSize))
15531610 let realizedPnl = muld(unrealizedPnl, realizedRatio)
1554- let $t06571165949 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl)
1555- let remainMargin = $t06571165949._1
1556- let positionBadDebt = $t06571165949._2
1557- let fundingPayment = $t06571165949._3
1611+ let $t06727267510 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl)
1612+ let remainMargin = $t06727267510._1
1613+ let positionBadDebt = $t06727267510._2
1614+ let fundingPayment = $t06727267510._3
15581615 let unrealizedPnlAfter = (unrealizedPnl - realizedPnl)
15591616 let remainOpenNotional = if ((oldPositionSize > 0))
15601617 then ((oldPositionNotional - exchangedQuoteAssetAmount) - unrealizedPnlAfter)
15611618 else ((unrealizedPnlAfter + oldPositionNotional) - exchangedQuoteAssetAmount)
1562- let newPositionMargin = muld(remainMargin, realizedRatio)
1619+ let newPositionOpenNotional = abs(remainOpenNotional)
1620+ let newPositionMargin = muld(newPositionOpenNotional, mr)
15631621 let newPositionSize = (oldPositionSize + exchangedPositionSize)
1564- let newPositionOpenNotional = abs(remainOpenNotional)
15651622 let newPositionLstUpdCPF = latestCumulativePremiumFraction(newPositionSize)
15661623 let openInterestNotionalAfter = (openInterestNotional() - exchangedQuoteAssetAmount)
15671624 if (if ((_minQuoteAssetAmount != 0))
15681625 then (_minQuoteAssetAmount > exchangedQuoteAssetAmount)
15691626 else false)
15701627 then throw(((("Limit error: " + toString(exchangedQuoteAssetAmount)) + " < ") + toString(_minQuoteAssetAmount)))
15711628 else $Tuple15(newPositionSize, newPositionMargin, newPositionOpenNotional, newPositionLstUpdCPF, positionBadDebt, realizedPnl, (abs((remainMargin - newPositionMargin)) + realizedPnl), quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, (totalLongPositionSize() - (if ((newPositionSize > 0))
15721629 then abs(exchangedPositionSize)
15731630 else 0)), (totalShortPositionSize() - (if ((0 > newPositionSize))
15741631 then abs(exchangedPositionSize)
15751632 else 0)), (openInterestLong() - (if ((newPositionSize > 0))
15761633 then exchangedQuoteAssetAmount
15771634 else 0)), (openInterestShort() - (if ((0 > newPositionSize))
15781635 then exchangedQuoteAssetAmount
15791636 else 0)))
15801637 }
15811638 else if ((_size > abs(oldPositionSize)))
15821639 then throw("Invalid closePosition parameters")
15831640 else {
1584- let $t06775268171 = internalClosePosition(_trader, true)
1585- let exchangedQuoteAssetAmount = $t06775268171._1
1586- let positionBadDebt = $t06775268171._2
1587- let realizedPnl = $t06775268171._3
1588- let marginToVault = $t06775268171._4
1589- let quoteAssetReserveAfter = $t06775268171._5
1590- let baseAssetReserveAfter = $t06775268171._6
1591- let totalPositionSizeAfter = $t06775268171._7
1592- let openInterestNotionalAfter = $t06775268171._8
1593- let x2 = $t06775268171._9
1594- let totalLongAfter = $t06775268171._10
1595- let totalShortAfter = $t06775268171._11
1596- let totalLongOpenInterestAfter = $t06775268171._12
1597- let totalShortOpenInterestAfter = $t06775268171._13
1641+ let $t06931369732 = internalClosePosition(_trader, true)
1642+ let exchangedQuoteAssetAmount = $t06931369732._1
1643+ let positionBadDebt = $t06931369732._2
1644+ let realizedPnl = $t06931369732._3
1645+ let marginToVault = $t06931369732._4
1646+ let quoteAssetReserveAfter = $t06931369732._5
1647+ let baseAssetReserveAfter = $t06931369732._6
1648+ let totalPositionSizeAfter = $t06931369732._7
1649+ let openInterestNotionalAfter = $t06931369732._8
1650+ let x2 = $t06931369732._9
1651+ let totalLongAfter = $t06931369732._10
1652+ let totalShortAfter = $t06931369732._11
1653+ let totalLongOpenInterestAfter = $t06931369732._12
1654+ let totalShortOpenInterestAfter = $t06931369732._13
15981655 if (if ((_minQuoteAssetAmount != 0))
15991656 then (_minQuoteAssetAmount > exchangedQuoteAssetAmount)
16001657 else false)
16011658 then throw(((("Limit error: " + toString(exchangedQuoteAssetAmount)) + " < ") + toString(_minQuoteAssetAmount)))
16021659 else $Tuple15(0, 0, 0, 0, positionBadDebt, realizedPnl, marginToVault, quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)
16031660 }
1604- let newPositionSize = $t06443968811._1
1605- let newPositionMargin = $t06443968811._2
1606- let newPositionOpenNotional = $t06443968811._3
1607- let newPositionLstUpdCPF = $t06443968811._4
1608- let positionBadDebt = $t06443968811._5
1609- let realizedPnl = $t06443968811._6
1610- let marginToVault = $t06443968811._7
1611- let quoteAssetReserveAfter = $t06443968811._8
1612- let baseAssetReserveAfter = $t06443968811._9
1613- let totalPositionSizeAfter = $t06443968811._10
1614- let openInterestNotionalAfter = $t06443968811._11
1615- let totalLongAfter = $t06443968811._12
1616- let totalShortAfter = $t06443968811._13
1617- let totalLongOpenInterestAfter = $t06443968811._14
1618- let totalShortOpenInterestAfter = $t06443968811._15
1661+ let newPositionSize = $t06593570372._1
1662+ let newPositionMargin = $t06593570372._2
1663+ let newPositionOpenNotional = $t06593570372._3
1664+ let newPositionLstUpdCPF = $t06593570372._4
1665+ let positionBadDebt = $t06593570372._5
1666+ let realizedPnl = $t06593570372._6
1667+ let marginToVault = $t06593570372._7
1668+ let quoteAssetReserveAfter = $t06593570372._8
1669+ let baseAssetReserveAfter = $t06593570372._9
1670+ let totalPositionSizeAfter = $t06593570372._10
1671+ let openInterestNotionalAfter = $t06593570372._11
1672+ let totalLongAfter = $t06593570372._12
1673+ let totalShortAfter = $t06593570372._13
1674+ let totalLongOpenInterestAfter = $t06593570372._14
1675+ let totalShortOpenInterestAfter = $t06593570372._15
16191676 if ((positionBadDebt > 0))
16201677 then throw("Unable to close position with bad debt")
16211678 else {
16221679 let withdrawAmount = abs(marginToVault)
16231680 let ammBalance = (cbalance() - withdrawAmount)
1624- let $t06902069149 = if ((0 > ammBalance))
1681+ let $t07058170788 = if ((0 > ammBalance))
16251682 then $Tuple2(0, abs(ammBalance))
16261683 else $Tuple2(ammBalance, 0)
1627- let ammNewBalance = $t06902069149._1
1628- let x11 = $t06902069149._2
1629- let unstake = invoke(vaultAddress(), "withdrawLocked", [withdrawAmount], nil)
1630- if ((unstake == unstake))
1684+ let ammNewBalance = $t07058170788._1
1685+ let x11 = $t07058170788._2
1686+ let $t07079570849 = getBorrowedByTrader(_trader)
1687+ let borrowed = $t07079570849._1
1688+ let assetId = $t07079570849._2
1689+ let $t07086471723 = if ((borrowed > 0))
1690+ then if ((withdrawAmount >= borrowed))
1691+ then {
1692+ let doRepay = invoke(collateralAddress(), "repay", [_trader, borrowed, assetId], nil)
1693+ if ((doRepay == doRepay))
1694+ then $Tuple2([ScriptTransfer(_traderAddress, borrowed, fromBase58String(assetId))], (withdrawAmount - borrowed))
1695+ else throw("Strict value is not equal to itself.")
1696+ }
1697+ else {
1698+ let realizeAndClose = invoke(collateralAddress(), "realizePartiallyAndClose", [_trader, withdrawAmount, assetId], nil)
1699+ if ((realizeAndClose == realizeAndClose))
1700+ then $Tuple2([ScriptTransfer(_traderAddress, withdrawAmount, fromBase58String(assetId))], 0)
1701+ else throw("Strict value is not equal to itself.")
1702+ }
1703+ else $Tuple2(nil, withdrawAmount)
1704+ if (($t07086471723 == $t07086471723))
16311705 then {
1632- let $t06936169415 = getBorrowedByTrader(_trader)
1633- let borrowed = $t06936169415._1
1634- let assetId = $t06936169415._2
1635- let $t06943070347 = if ((borrowed > 0))
1636- then if ((withdrawAmount >= borrowed))
1637- then {
1638- let doRepay = invoke(collateralAddress(), "repay", [_trader, assetId], [AttachedPayment(quoteAsset(), borrowed)])
1639- if ((doRepay == doRepay))
1640- then $Tuple2([ScriptTransfer(_traderAddress, borrowed, fromBase58String(assetId))], (withdrawAmount - borrowed))
1641- else throw("Strict value is not equal to itself.")
1642- }
1643- else {
1644- let realizeAndClose = invoke(collateralAddress(), "realizePartiallyAndClose", [_trader, assetId], [AttachedPayment(quoteAsset(), withdrawAmount)])
1645- if ((realizeAndClose == realizeAndClose))
1646- then $Tuple2([ScriptTransfer(_traderAddress, withdrawAmount, fromBase58String(assetId))], 0)
1647- else throw("Strict value is not equal to itself.")
1648- }
1649- else $Tuple2(nil, withdrawAmount)
1650- if (($t06943070347 == $t06943070347))
1706+ let quoteWithdrawAmount = $t07086471723._2
1707+ let sendCollateralAction = $t07086471723._1
1708+ let unstake = if ((quoteWithdrawAmount > 0))
16511709 then {
1652- let quoteWithdrawAmount = $t06943070347._2
1653- let sendCollateralAction = $t06943070347._1
1710+ let unstake = invoke(vaultAddress(), "withdrawLocked", [quoteWithdrawAmount], nil)
1711+ if ((unstake == unstake))
1712+ then nil
1713+ else throw("Strict value is not equal to itself.")
1714+ }
1715+ else nil
1716+ if ((unstake == unstake))
1717+ then {
16541718 let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, 0], nil)
16551719 if ((notifyNotional == notifyNotional))
16561720 then (((((if ((newPositionSize == 0))
16571721 then deletePosition(_trader)
16581722 else updatePosition(_trader, newPositionSize, newPositionMargin, newPositionOpenNotional, newPositionLstUpdCPF)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)) ++ (if ((quoteWithdrawAmount > 0))
16591723 then withdraw(_traderAddress, quoteWithdrawAmount)
16601724 else nil)) ++ updateBalance(ammNewBalance)) ++ sendCollateralAction)
16611725 else throw("Strict value is not equal to itself.")
16621726 }
16631727 else throw("Strict value is not equal to itself.")
16641728 }
16651729 else throw("Strict value is not equal to itself.")
16661730 }
16671731 }
16681732 }
16691733 else throw("Strict value is not equal to itself.")
16701734 }
16711735
16721736
16731737
16741738 @Callable(i)
16751739 func liquidate (_trader) = {
16761740 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
16771741 if ((sync == sync))
16781742 then {
16791743 let spotMarginRatio = getMarginRatioByOption(_trader, PNL_OPTION_SPOT)
16801744 let marginRatio = if (isOverFluctuationLimit())
16811745 then {
16821746 let oracleMarginRatio = getMarginRatioByOption(_trader, PNL_OPTION_ORACLE)
16831747 vmax(spotMarginRatio, oracleMarginRatio)
16841748 }
16851749 else spotMarginRatio
16861750 if (if (if (if (!(requireMoreMarginRatio(marginRatio, maintenanceMarginRatio(), false)))
16871751 then true
16881752 else !(requireOpenPosition(_trader)))
16891753 then true
16901754 else !(initialized()))
16911755 then true
16921756 else paused())
16931757 then throw("Unable to liquidate")
16941758 else if (if (if ((spotMarginRatio > liquidationFeeRatio()))
16951759 then (partialLiquidationRatio() > 0)
16961760 else false)
16971761 then (DECIMAL_UNIT > partialLiquidationRatio())
16981762 else false)
16991763 then {
1700- let $t07239672546 = getPosition(_trader)
1701- let oldPositionSize = $t07239672546._1
1702- let oldPositionMargin = $t07239672546._2
1703- let oldPositionOpenNotional = $t07239672546._3
1704- let oldPositionLstUpdCPF = $t07239672546._4
1764+ let $t07402074170 = getPosition(_trader)
1765+ let oldPositionSize = $t07402074170._1
1766+ let oldPositionMargin = $t07402074170._2
1767+ let oldPositionOpenNotional = $t07402074170._3
1768+ let oldPositionLstUpdCPF = $t07402074170._4
17051769 let _direction = if ((oldPositionSize > 0))
17061770 then DIR_SHORT
17071771 else DIR_LONG
17081772 let isAdd = (_direction == DIR_LONG)
17091773 let exchangedQuoteAssetAmount = getPartialLiquidationAmount(_trader, oldPositionSize)
1710- let $t07277172875 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1711- let oldPositionNotional = $t07277172875._1
1712- let unrealizedPnl = $t07277172875._2
1713- let $t07288373070 = swapInput(isAdd, exchangedQuoteAssetAmount)
1714- let exchangedPositionSize = $t07288373070._1
1715- let quoteAssetReserveAfter = $t07288373070._2
1716- let baseAssetReserveAfter = $t07288373070._3
1717- let totalPositionSizeAfter = $t07288373070._4
1774+ let $t07439574499 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1775+ let oldPositionNotional = $t07439574499._1
1776+ let unrealizedPnl = $t07439574499._2
1777+ let $t07450774694 = swapInput(isAdd, exchangedQuoteAssetAmount)
1778+ let exchangedPositionSize = $t07450774694._1
1779+ let quoteAssetReserveAfter = $t07450774694._2
1780+ let baseAssetReserveAfter = $t07450774694._3
1781+ let totalPositionSizeAfter = $t07450774694._4
17181782 let liquidationRatio = divd(abs(exchangedPositionSize), abs(oldPositionSize))
17191783 let realizedPnl = muld(unrealizedPnl, liquidationRatio)
1720- let $t07335973592 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl)
1721- let remainMargin = $t07335973592._1
1722- let badDebt = $t07335973592._2
1723- let fundingPayment = $t07335973592._3
1784+ let $t07498375216 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl)
1785+ let remainMargin = $t07498375216._1
1786+ let badDebt = $t07498375216._2
1787+ let fundingPayment = $t07498375216._3
17241788 let unrealizedPnlAfter = (unrealizedPnl - realizedPnl)
17251789 let remainOpenNotional = if ((oldPositionSize > 0))
17261790 then ((oldPositionNotional - exchangedQuoteAssetAmount) - unrealizedPnlAfter)
17271791 else ((unrealizedPnlAfter + oldPositionNotional) - exchangedQuoteAssetAmount)
17281792 let liquidationPenalty = muld(exchangedQuoteAssetAmount, liquidationFeeRatio())
17291793 let feeToLiquidator = (liquidationPenalty / 2)
1730- let feeToInsurance = (liquidationPenalty - feeToLiquidator)
1794+ let feeToVault = (liquidationPenalty - feeToLiquidator)
17311795 let newPositionMargin = (remainMargin - liquidationPenalty)
17321796 let newPositionSize = (oldPositionSize + exchangedPositionSize)
17331797 let newPositionOpenNotional = abs(remainOpenNotional)
17341798 let newPositionLstUpdCPF = latestCumulativePremiumFraction(newPositionSize)
17351799 let openInterestNotionalAfter = (openInterestNotional() - exchangedQuoteAssetAmount)
17361800 let ammBalance = (cbalance() - liquidationPenalty)
1737- let $t07476574894 = if ((0 > ammBalance))
1801+ let $t07638576514 = if ((0 > ammBalance))
17381802 then $Tuple2(0, abs(ammBalance))
17391803 else $Tuple2(ammBalance, 0)
1740- let newAmmBalance = $t07476574894._1
1741- let x11 = $t07476574894._2
1742- let $t07490274956 = getBorrowedByTrader(_trader)
1743- let borrowed = $t07490274956._1
1744- let assetId = $t07490274956._2
1804+ let newAmmBalance = $t07638576514._1
1805+ let x11 = $t07638576514._2
1806+ let $t07652276576 = getBorrowedByTrader(_trader)
1807+ let borrowed = $t07652276576._1
1808+ let assetId = $t07652276576._2
17451809 let doLiquidateCollateral = if ((borrowed > 0))
17461810 then {
17471811 let collateralToSell = muld(borrowed, liquidationRatio)
17481812 let realizeAndClose = invoke(collateralAddress(), "realizePartially", [_trader, assetId, collateralToSell], nil)
17491813 if ((realizeAndClose == realizeAndClose))
17501814 then nil
17511815 else throw("Strict value is not equal to itself.")
17521816 }
17531817 else nil
17541818 if ((doLiquidateCollateral == doLiquidateCollateral))
17551819 then {
17561820 let unstake = invoke(vaultAddress(), "withdrawLocked", [liquidationPenalty], nil)
17571821 if ((unstake == unstake))
17581822 then {
1759- let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToInsurance)])
1823+ let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)])
17601824 if ((depositInsurance == depositInsurance))
17611825 then {
17621826 let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, newPositionOpenNotional], nil)
17631827 if ((notifyNotional == notifyNotional))
17641828 then (((updatePosition(_trader, newPositionSize, newPositionMargin, newPositionOpenNotional, newPositionLstUpdCPF) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, (totalLongPositionSize() - (if ((newPositionSize > 0))
17651829 then abs(exchangedPositionSize)
17661830 else 0)), (totalShortPositionSize() - (if ((0 > newPositionSize))
17671831 then abs(exchangedPositionSize)
17681832 else 0)), (openInterestLong() - (if ((newPositionSize > 0))
17691833 then exchangedQuoteAssetAmount
17701834 else 0)), (openInterestShort() - (if ((0 > newPositionSize))
17711835 then exchangedQuoteAssetAmount
17721836 else 0)))) ++ withdraw(i.caller, feeToLiquidator)) ++ updateBalance(newAmmBalance))
17731837 else throw("Strict value is not equal to itself.")
17741838 }
17751839 else throw("Strict value is not equal to itself.")
17761840 }
17771841 else throw("Strict value is not equal to itself.")
17781842 }
17791843 else throw("Strict value is not equal to itself.")
17801844 }
17811845 else {
1782- let $t07665577150 = internalClosePosition(_trader, false)
1783- let x1 = $t07665577150._1
1784- let badDebt = $t07665577150._2
1785- let x2 = $t07665577150._3
1786- let x3 = $t07665577150._4
1787- let quoteAssetReserveAfter = $t07665577150._5
1788- let baseAssetReserveAfter = $t07665577150._6
1789- let totalPositionSizeAfter = $t07665577150._7
1790- let openInterestNotionalAfter = $t07665577150._8
1791- let exchangedQuoteAssetAmount = $t07665577150._9
1792- let totalLongAfter = $t07665577150._10
1793- let totalShortAfter = $t07665577150._11
1794- let totalLongOpenInterestAfter = $t07665577150._12
1795- let totalShortOpenInterestAfter = $t07665577150._13
1846+ let $t07827178766 = internalClosePosition(_trader, false)
1847+ let x1 = $t07827178766._1
1848+ let badDebt = $t07827178766._2
1849+ let x2 = $t07827178766._3
1850+ let x3 = $t07827178766._4
1851+ let quoteAssetReserveAfter = $t07827178766._5
1852+ let baseAssetReserveAfter = $t07827178766._6
1853+ let totalPositionSizeAfter = $t07827178766._7
1854+ let openInterestNotionalAfter = $t07827178766._8
1855+ let exchangedQuoteAssetAmount = $t07827178766._9
1856+ let totalLongAfter = $t07827178766._10
1857+ let totalShortAfter = $t07827178766._11
1858+ let totalLongOpenInterestAfter = $t07827178766._12
1859+ let totalShortOpenInterestAfter = $t07827178766._13
17961860 let liquidationPenalty = muld(exchangedQuoteAssetAmount, liquidationFeeRatio())
17971861 let feeToLiquidator = (liquidationPenalty / 2)
1798- let feeToInsurance = (liquidationPenalty - feeToLiquidator)
1862+ let feeToVault = (liquidationPenalty - feeToLiquidator)
17991863 let ammBalance = (cbalance() - liquidationPenalty)
1800- let $t07756277691 = if ((0 > ammBalance))
1864+ let $t07917479303 = if ((0 > ammBalance))
18011865 then $Tuple2(0, abs(ammBalance))
18021866 else $Tuple2(ammBalance, 0)
1803- let newAmmBalance = $t07756277691._1
1804- let x11 = $t07756277691._2
1805- let $t07769977753 = getBorrowedByTrader(_trader)
1806- let borrowed = $t07769977753._1
1807- let assetId = $t07769977753._2
1867+ let newAmmBalance = $t07917479303._1
1868+ let x11 = $t07917479303._2
1869+ let $t07931179365 = getBorrowedByTrader(_trader)
1870+ let borrowed = $t07931179365._1
1871+ let assetId = $t07931179365._2
18081872 let doLiquidateCollateral = if ((borrowed > 0))
18091873 then {
1810- let realizeAndClose = invoke(collateralAddress(), "realizePartiallyAndClose", [_trader, assetId], nil)
1874+ let realizeAndClose = invoke(collateralAddress(), "realizePartiallyAndClose", [_trader, 0, assetId], nil)
18111875 if ((realizeAndClose == realizeAndClose))
18121876 then nil
18131877 else throw("Strict value is not equal to itself.")
18141878 }
18151879 else nil
18161880 if ((doLiquidateCollateral == doLiquidateCollateral))
18171881 then {
18181882 let x = if ((badDebt > 0))
18191883 then {
18201884 let lockBadDebt = invoke(vaultAddress(), "exchangeFreeAndLocked", [badDebt], nil)
18211885 if ((lockBadDebt == lockBadDebt))
18221886 then nil
18231887 else throw("Strict value is not equal to itself.")
18241888 }
18251889 else nil
18261890 if ((x == x))
18271891 then {
18281892 let unstake = invoke(vaultAddress(), "withdrawLocked", [liquidationPenalty], nil)
18291893 if ((unstake == unstake))
18301894 then {
1831- let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToInsurance)])
1895+ let depositInsurance = invoke(vaultAddress(), "addFree", nil, [AttachedPayment(quoteAsset(), feeToVault)])
18321896 if ((depositInsurance == depositInsurance))
18331897 then {
18341898 let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, 0], nil)
18351899 if ((notifyNotional == notifyNotional))
18361900 then (((deletePosition(_trader) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter, totalLongOpenInterestAfter, totalShortOpenInterestAfter)) ++ withdraw(i.caller, feeToLiquidator)) ++ updateBalance(newAmmBalance))
18371901 else throw("Strict value is not equal to itself.")
18381902 }
18391903 else throw("Strict value is not equal to itself.")
18401904 }
18411905 else throw("Strict value is not equal to itself.")
18421906 }
18431907 else throw("Strict value is not equal to itself.")
18441908 }
18451909 else throw("Strict value is not equal to itself.")
18461910 }
18471911 }
18481912 else throw("Strict value is not equal to itself.")
18491913 }
18501914
18511915
18521916
18531917 @Callable(i)
18541918 func payFunding () = {
18551919 let fundingBlockTimestamp = nextFundingBlockTimestamp()
18561920 if (if (if ((fundingBlockTimestamp > lastBlock.timestamp))
18571921 then true
18581922 else !(initialized()))
18591923 then true
18601924 else paused())
18611925 then throw(((("Invalid funding block timestamp: " + toString(lastBlock.timestamp)) + " < ") + toString(fundingBlockTimestamp)))
18621926 else {
18631927 let underlyingPrice = getOracleTwapPrice()
1864- let $t07956079622 = getFunding()
1865- let shortPremiumFraction = $t07956079622._1
1866- let longPremiumFraction = $t07956079622._2
1928+ let $t08117281234 = getFunding()
1929+ let shortPremiumFraction = $t08117281234._1
1930+ let longPremiumFraction = $t08117281234._2
18671931 updateFunding((fundingBlockTimestamp + fundingPeriodSeconds()), (latestLongCumulativePremiumFraction() + longPremiumFraction), (latestShortCumulativePremiumFraction() + shortPremiumFraction), divd(longPremiumFraction, underlyingPrice), divd(shortPremiumFraction, underlyingPrice))
18681932 }
18691933 }
18701934
18711935
18721936
18731937 @Callable(i)
18741938 func syncTerminalPriceToOracle () = {
1875- let $t08000480125 = getSyncTerminalPrice(getOracleTwapPrice())
1876- let newQuoteAssetWeight = $t08000480125._1
1877- let newBaseAssetWeight = $t08000480125._2
1878- let marginToVault = $t08000480125._3
1879- let lockBadDebt = invoke(vaultAddress(), "exchangeFreeAndLocked", [marginToVault], nil)
1880- if ((lockBadDebt == lockBadDebt))
1939+ let $t08161681737 = getSyncTerminalPrice(getOracleTwapPrice())
1940+ let newQuoteAssetWeight = $t08161681737._1
1941+ let newBaseAssetWeight = $t08161681737._2
1942+ let marginToVault = $t08161681737._3
1943+ let doExchangePnL = if ((marginToVault != 0))
1944+ then {
1945+ let doExchangePnL = invoke(vaultAddress(), "exchangeFreeAndLocked", [marginToVault], nil)
1946+ if ((doExchangePnL == doExchangePnL))
1947+ then nil
1948+ else throw("Strict value is not equal to itself.")
1949+ }
1950+ else nil
1951+ if ((doExchangePnL == doExchangePnL))
18811952 then updateAmmWeights(newQuoteAssetWeight, newBaseAssetWeight)
18821953 else throw("Strict value is not equal to itself.")
18831954 }
18841955
18851956
18861957
18871958 @Callable(i)
18881959 func view_calcRemainMarginWithFundingPayment (_trader) = {
18891960 let sync = invoke(this, "syncTerminalPriceToOracle", nil, nil)
18901961 if ((sync == sync))
18911962 then {
1892- let $t08050280603 = getPosition(_trader)
1893- let positionSize = $t08050280603._1
1894- let positionMargin = $t08050280603._2
1895- let pon = $t08050280603._3
1896- let positionLstUpdCPF = $t08050280603._4
1897- let $t08060680707 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1898- let positionNotional = $t08060680707._1
1899- let unrealizedPnl = $t08060680707._2
1900- let $t08071080882 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl)
1901- let remainMargin = $t08071080882._1
1902- let badDebt = $t08071080882._2
1903- let fundingPayment = $t08071080882._3
1963+ let $t08221382314 = getPosition(_trader)
1964+ let positionSize = $t08221382314._1
1965+ let positionMargin = $t08221382314._2
1966+ let pon = $t08221382314._3
1967+ let positionLstUpdCPF = $t08221382314._4
1968+ let $t08231782418 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)
1969+ let positionNotional = $t08231782418._1
1970+ let unrealizedPnl = $t08231782418._2
1971+ let $t08242182593 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl)
1972+ let remainMargin = $t08242182593._1
1973+ let badDebt = $t08242182593._2
1974+ let fundingPayment = $t08242182593._3
19041975 throw((((((s(remainMargin) + s(fundingPayment)) + s(getMarginRatio(_trader))) + s(unrealizedPnl)) + s(badDebt)) + s(positionNotional)))
19051976 }
19061977 else throw("Strict value is not equal to itself.")
19071978 }
19081979
19091980
19101981
19111982 @Callable(i)
19121983 func view_getPegAdjustCost (_price) = {
19131984 let result = getSyncTerminalPrice(_price)
19141985 throw(toString(result._3))
19151986 }
19161987
19171988
19181989
19191990 @Callable(i)
19201991 func view_getTerminalAmmPrice () = {
1921- let $t08122981310 = getTerminalAmmState()
1922- let terminalQuoteAssetReserve = $t08122981310._1
1923- let terminalBaseAssetReserve = $t08122981310._2
1992+ let $t08294083021 = getTerminalAmmState()
1993+ let terminalQuoteAssetReserve = $t08294083021._1
1994+ let terminalBaseAssetReserve = $t08294083021._2
19241995 let price = divd(muld(terminalQuoteAssetReserve, qtAstW()), muld(terminalBaseAssetReserve, bsAstW()))
19251996 throw(toString(price))
19261997 }
19271998
19281999
19292000
19302001 @Callable(i)
19312002 func view_getFunding () = {
19322003 let underlyingPrice = getOracleTwapPrice()
1933- let $t08152981591 = getFunding()
1934- let shortPremiumFraction = $t08152981591._1
1935- let longPremiumFraction = $t08152981591._2
2004+ let $t08324083302 = getFunding()
2005+ let shortPremiumFraction = $t08324083302._1
2006+ let longPremiumFraction = $t08324083302._2
19362007 let longFunding = divd(longPremiumFraction, underlyingPrice)
19372008 let shortFunding = divd(shortPremiumFraction, underlyingPrice)
19382009 throw((((s(longFunding) + s(shortFunding)) + s(getTwapSpotPrice())) + s(getOracleTwapPrice())))
19392010 }
19402011
19412012
19422013
19432014 @Callable(i)
19442015 func view_getBorrowedByTrader (_trader) = {
1945- let $t08188181935 = getBorrowedByTrader(_trader)
1946- let borrowed = $t08188181935._1
1947- let assetId = $t08188181935._2
2016+ let $t08359283646 = getBorrowedByTrader(_trader)
2017+ let borrowed = $t08359283646._1
2018+ let assetId = $t08359283646._2
19482019 throw((s(borrowed) + assetId))
19492020 }
19502021
19512022
19522023
19532024 @Callable(i)
19542025 func computeSpotPrice () = {
19552026 let result = getSpotPrice()
19562027 $Tuple2(nil, result)
19572028 }
19582029
19592030
19602031
19612032 @Callable(i)
19622033 func computeFeeForTraderWithArtifact (_trader,_artifactId) = {
19632034 let result = getForTraderWithArtifact(_trader, _artifactId)
19642035 $Tuple2(nil, result)
19652036 }
19662037
19672038
19682039 @Verifier(tx)
19692040 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], adminPublicKey())
19702041

github/deemru/w8io/169f3d6 
266.25 ms