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