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