tx · DmdNkrQKunypTaYHLz2vMuE3w9QPKzWomTa3reYtQN1P 3NBH3LGg2DsaEtyBr495XEdaFuiLYSNyr3k: -0.05000000 Waves 2022.09.02 17:04 [2211600] smart account 3NBH3LGg2DsaEtyBr495XEdaFuiLYSNyr3k > SELF 0.00000000 Waves
{ "type": 13, "id": "DmdNkrQKunypTaYHLz2vMuE3w9QPKzWomTa3reYtQN1P", "fee": 5000000, "feeAssetId": null, "timestamp": 1662127522753, "version": 2, "chainId": 84, "sender": "3NBH3LGg2DsaEtyBr495XEdaFuiLYSNyr3k", "senderPublicKey": "6rHNfG82m33YnDLzeMuCFn5XNvbNwGhR4ovSFhgJvbxP", "proofs": [ "4T5XKzhy3KYycXAooeXXKD785wyxT5kYk3AgkQ4WjfBBCThC99ip7UoJ779xiQP2iNnir7WU5y7bfXqZoQcEQAQ5" ], "script": "base64:BgJiCAISABIAEgMKAQESAwoBARILCgkBAQEBAQEBAQESEAoOAQEBAQEBAQgICAEBAQESAwoBARIFCgMBAQESBQoDAQEBEgASAwoBARIAEgMKAQgSABIDCgEIEgMKAQgSBAoCCAGDAQAJa19vcmFfa2V5AglrX29yYV9rZXkAD2tfb3JhX2Jsb2NrX2tleQIPa19vcmFfYmxvY2tfa2V5AAVrX29yYQIFa19vcmEACWtfYmFsYW5jZQIJa19iYWxhbmNlAA5rX3Bvc2l0aW9uU2l6ZQIOa19wb3NpdGlvblNpemUAEGtfcG9zaXRpb25NYXJnaW4CEGtfcG9zaXRpb25NYXJnaW4AFmtfcG9zaXRpb25PcGVuTm90aW9uYWwCFmtfcG9zaXRpb25PcGVuTm90aW9uYWwALmtfcG9zaXRpb25MYXN0VXBkYXRlZEN1bXVsYXRpdmVQcmVtaXVtRnJhY3Rpb24CEmtfcG9zaXRpb25GcmFjdGlvbgAUa19wb3NpdGlvbkNsb3NlZERhdGUCFGtfcG9zaXRpb25DbG9zZWREYXRlAA1rX2luaXRpYWxpemVkAg1rX2luaXRpYWxpemVkAAhrX3BhdXN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ted Prev: G4WcqzEHfajQmSVV4ybQjNmM9XbLwnGh3yFwQNcY5pQv Next: FL4LZNEcHV4VqT1wVQYsGpMJbpN7smDWgUWC5TkBr8C8 Diff:
Old | New | Differences | |
---|---|---|---|
16 | 16 | let k_positionOpenNotional = "k_positionOpenNotional" | |
17 | 17 | ||
18 | 18 | let k_positionLastUpdatedCumulativePremiumFraction = "k_positionFraction" | |
19 | + | ||
20 | + | let k_positionClosedDate = "k_positionClosedDate" | |
19 | 21 | ||
20 | 22 | let k_initialized = "k_initialized" | |
21 | 23 | ||
89 | 91 | ||
90 | 92 | let k_miner_address = "k_miner_address" | |
91 | 93 | ||
94 | + | let k_orders_address = "k_orders_address" | |
95 | + | ||
92 | 96 | func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set") | |
93 | 97 | ||
94 | 98 | ||
104 | 108 | func quoteAssetStaking () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_quote_staking)), "Quote asset staking not set") | |
105 | 109 | ||
106 | 110 | ||
107 | - | func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), " | |
111 | + | func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), "Staking not set") | |
108 | 112 | ||
109 | 113 | ||
110 | 114 | func insuranceAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_insurance_address)), "Insurance not set") | |
111 | 115 | ||
112 | 116 | ||
113 | - | func minerAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_miner_address)), "Insurance not set") | |
117 | + | func minerAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_miner_address)), "Miner not set") | |
118 | + | ||
119 | + | ||
120 | + | func ordersAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_orders_address)), "Orders not set") | |
114 | 121 | ||
115 | 122 | ||
116 | 123 | let DIR_LONG = 1 | |
257 | 264 | func totalLongPositionSize () = int(k_totalLongPositionSize) | |
258 | 265 | ||
259 | 266 | ||
267 | + | func getActualCaller (i) = valueOrElse(getString(ordersAddress(), "k_sender"), toString(i.caller)) | |
268 | + | ||
269 | + | ||
260 | 270 | func requireMoreMarginRatio (_marginRatio,_baseMarginRatio,_largerThanOrEqualTo) = { | |
261 | 271 | let remainingMarginRatio = (_marginRatio - _baseMarginRatio) | |
262 | 272 | if (if (_largerThanOrEqualTo) | |
327 | 337 | let amountBaseAssetBought = if (_isAdd) | |
328 | 338 | then amountBaseAssetBoughtAbs | |
329 | 339 | else -(amountBaseAssetBoughtAbs) | |
330 | - | let $ | |
331 | - | let quoteAssetReserveAfter1 = $ | |
332 | - | let baseAssetReserveAfter1 = $ | |
333 | - | let totalPositionSizeAfter1 = $ | |
334 | - | let cumulativeNotionalAfter1 = $ | |
340 | + | let $t01260512798 = updateReserve(_isAdd, _quoteAssetAmount, amountBaseAssetBoughtAbs) | |
341 | + | let quoteAssetReserveAfter1 = $t01260512798._1 | |
342 | + | let baseAssetReserveAfter1 = $t01260512798._2 | |
343 | + | let totalPositionSizeAfter1 = $t01260512798._3 | |
344 | + | let cumulativeNotionalAfter1 = $t01260512798._4 | |
335 | 345 | let priceBefore = divd(_qtAstR, _bsAstR) | |
336 | 346 | let marketPrice = divd(_quoteAssetAmount, amountBaseAssetBoughtAbs) | |
337 | 347 | let priceDiff = abs((priceBefore - marketPrice)) | |
351 | 361 | } | |
352 | 362 | else 0 | |
353 | 363 | let signedMargin = ((_marginDelta - fundingPayment) + _oldPositionMargin) | |
354 | - | let $ | |
364 | + | let $t01428914416 = if ((0 > signedMargin)) | |
355 | 365 | then $Tuple2(0, abs(signedMargin)) | |
356 | 366 | else $Tuple2(abs(signedMargin), 0) | |
357 | - | let remainMargin = $ | |
358 | - | let badDebt = $ | |
367 | + | let remainMargin = $t01428914416._1 | |
368 | + | let badDebt = $t01428914416._2 | |
359 | 369 | $Tuple3(remainMargin, badDebt, fundingPayment) | |
360 | 370 | } | |
361 | 371 | ||
372 | 382 | let quoteAssetAfter = divd(k, baseAssetPoolAmountAfter) | |
373 | 383 | let quoteAssetSold = abs((quoteAssetAfter - _quoteAssetReserve)) | |
374 | 384 | let maxPriceImpactValue = maxPriceImpact() | |
375 | - | let $ | |
376 | - | let quoteAssetReserveAfter1 = $ | |
377 | - | let baseAssetReserveAfter1 = $ | |
378 | - | let totalPositionSizeAfter1 = $ | |
379 | - | let cumulativeNotionalAfter1 = $ | |
385 | + | let $t01539315586 = updateReserve(!(_isAdd), quoteAssetSold, _baseAssetAmount) | |
386 | + | let quoteAssetReserveAfter1 = $t01539315586._1 | |
387 | + | let baseAssetReserveAfter1 = $t01539315586._2 | |
388 | + | let totalPositionSizeAfter1 = $t01539315586._3 | |
389 | + | let cumulativeNotionalAfter1 = $t01539315586._4 | |
380 | 390 | let marketPrice = divd(quoteAssetSold, _baseAssetAmount) | |
381 | 391 | let priceDiff = abs((priceBefore - marketPrice)) | |
382 | 392 | let priceImpact = (DECIMAL_UNIT - divd(priceBefore, (priceBefore + priceDiff))) | |
435 | 445 | let isShort = (0 > _positionSize) | |
436 | 446 | let positionNotional = if ((_option == PNL_OPTION_SPOT)) | |
437 | 447 | then { | |
438 | - | let $ | |
439 | - | let outPositionNotional = $ | |
440 | - | let x1 = $ | |
441 | - | let x2 = $ | |
442 | - | let x3 = $ | |
448 | + | let $t01880418975 = swapOutputWithReserves(!(isShort), positionSizeAbs, false, _quoteAssetReserve, _baseAssetReserve) | |
449 | + | let outPositionNotional = $t01880418975._1 | |
450 | + | let x1 = $t01880418975._2 | |
451 | + | let x2 = $t01880418975._3 | |
452 | + | let x3 = $t01880418975._4 | |
443 | 453 | outPositionNotional | |
444 | 454 | } | |
445 | 455 | else muld(positionSizeAbs, getOracleTwapPrice()) | |
448 | 458 | ||
449 | 459 | ||
450 | 460 | func getPositionNotionalAndUnrealizedPnl (_trader,_option) = { | |
451 | - | let $ | |
452 | - | let positionSize = $ | |
453 | - | let positionMargin = $ | |
454 | - | let positionOpenNotional = $ | |
455 | - | let positionLstUpdCPF = $ | |
461 | + | let $t01936919497 = getPosition(_trader) | |
462 | + | let positionSize = $t01936919497._1 | |
463 | + | let positionMargin = $t01936919497._2 | |
464 | + | let positionOpenNotional = $t01936919497._3 | |
465 | + | let positionLstUpdCPF = $t01936919497._4 | |
456 | 466 | if ((positionSize == 0)) | |
457 | 467 | then throw("Invalid position size") | |
458 | 468 | else { | |
470 | 480 | ||
471 | 481 | ||
472 | 482 | func getMarginRatioByOption (_trader,_option) = { | |
473 | - | let $ | |
474 | - | let positionSize = $ | |
475 | - | let positionMargin = $ | |
476 | - | let pon = $ | |
477 | - | let positionLstUpdCPF = $ | |
478 | - | let $ | |
479 | - | let positionNotional = $ | |
480 | - | let unrealizedPnl = $ | |
481 | - | let $ | |
482 | - | let remainMargin = $ | |
483 | - | let badDebt = $ | |
483 | + | let $t02033020441 = getPosition(_trader) | |
484 | + | let positionSize = $t02033020441._1 | |
485 | + | let positionMargin = $t02033020441._2 | |
486 | + | let pon = $t02033020441._3 | |
487 | + | let positionLstUpdCPF = $t02033020441._4 | |
488 | + | let $t02044720540 = getPositionNotionalAndUnrealizedPnl(_trader, _option) | |
489 | + | let positionNotional = $t02044720540._1 | |
490 | + | let unrealizedPnl = $t02044720540._2 | |
491 | + | let $t02054520711 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl) | |
492 | + | let remainMargin = $t02054520711._1 | |
493 | + | let badDebt = $t02054520711._2 | |
484 | 494 | calcMarginRatio(remainMargin, badDebt, positionNotional) | |
485 | 495 | } | |
486 | 496 | ||
505 | 515 | ||
506 | 516 | ||
507 | 517 | func internalClosePosition (_trader,_checkMaxPriceImpact) = { | |
508 | - | let $ | |
509 | - | let positionSize = $ | |
510 | - | let positionMargin = $ | |
511 | - | let positionOpenNotional = $ | |
512 | - | let positionLstUpdCPF = $ | |
518 | + | let $t02189322021 = getPosition(_trader) | |
519 | + | let positionSize = $t02189322021._1 | |
520 | + | let positionMargin = $t02189322021._2 | |
521 | + | let positionOpenNotional = $t02189322021._3 | |
522 | + | let positionLstUpdCPF = $t02189322021._4 | |
513 | 523 | let unrealizedPnl = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)._2 | |
514 | - | let $ | |
515 | - | let remainMargin = $ | |
516 | - | let badDebt = $ | |
524 | + | let $t02211622284 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl) | |
525 | + | let remainMargin = $t02211622284._1 | |
526 | + | let badDebt = $t02211622284._2 | |
517 | 527 | let exchangedPositionSize = -(positionSize) | |
518 | 528 | let realizedPnl = unrealizedPnl | |
519 | 529 | let marginToVault = -(remainMargin) | |
520 | - | let $ | |
521 | - | let exchangedQuoteAssetAmount = $ | |
522 | - | let quoteAssetReserveAfter = $ | |
523 | - | let baseAssetReserveAfter = $ | |
524 | - | let totalPositionSizeAfter = $ | |
525 | - | let cumulativeNotionalAfter = $ | |
526 | - | let totalLongAfter = $ | |
527 | - | let totalShortAfter = $ | |
530 | + | let $t02241122722 = swapOutput((positionSize > 0), abs(positionSize), _checkMaxPriceImpact) | |
531 | + | let exchangedQuoteAssetAmount = $t02241122722._1 | |
532 | + | let quoteAssetReserveAfter = $t02241122722._2 | |
533 | + | let baseAssetReserveAfter = $t02241122722._3 | |
534 | + | let totalPositionSizeAfter = $t02241122722._4 | |
535 | + | let cumulativeNotionalAfter = $t02241122722._5 | |
536 | + | let totalLongAfter = $t02241122722._6 | |
537 | + | let totalShortAfter = $t02241122722._7 | |
528 | 538 | let openInterestNotionalAfter = (openInterestNotional() - positionOpenNotional) | |
529 | 539 | $Tuple12(exchangedPositionSize, badDebt, realizedPnl, marginToVault, quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInterestNotionalAfter, exchangedQuoteAssetAmount, totalLongAfter, totalShortAfter) | |
530 | 540 | } | |
612 | 622 | else ((updateAmmReserves(_qtAstR, _bsAstR) ++ [IntegerEntry(k_totalPositionSize, _totalPositionSizeAfter), IntegerEntry(k_cumulativeNotional, _cumulativeNotionalAfter), IntegerEntry(k_openInterestNotional, _openInterestNotional), IntegerEntry(k_totalLongPositionSize, _totalLongPositionSize), IntegerEntry(k_totalShortPositionSize, _totalShortPositionSize)]) ++ appendTwap(divd(_qtAstR, _bsAstR))) | |
613 | 623 | ||
614 | 624 | ||
615 | - | func deletePosition (_address) = [DeleteEntry(toCompositeKey(k_positionSize, _address)), DeleteEntry(toCompositeKey(k_positionMargin, _address)), DeleteEntry(toCompositeKey(k_positionOpenNotional, _address)), DeleteEntry(toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _address))] | |
625 | + | func deletePosition (_address) = [DeleteEntry(toCompositeKey(k_positionSize, _address)), DeleteEntry(toCompositeKey(k_positionMargin, _address)), DeleteEntry(toCompositeKey(k_positionOpenNotional, _address)), DeleteEntry(toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _address)), IntegerEntry(toCompositeKey(k_positionClosedDate, _address), lastBlock.timestamp)] | |
616 | 626 | ||
617 | 627 | ||
618 | 628 | func withdraw (_address,_amount) = { | |
736 | 746 | else paused()) | |
737 | 747 | then throw("Invalid decreasePosition parameters") | |
738 | 748 | else { | |
739 | - | let $ | |
740 | - | let oldPositionSize = $ | |
741 | - | let oldPositionMargin = $ | |
742 | - | let oldPositionOpenNotional = $ | |
743 | - | let oldPositionLstUpdCPF = $ | |
749 | + | let $t03470134853 = getPosition(toString(i.caller)) | |
750 | + | let oldPositionSize = $t03470134853._1 | |
751 | + | let oldPositionMargin = $t03470134853._2 | |
752 | + | let oldPositionOpenNotional = $t03470134853._3 | |
753 | + | let oldPositionLstUpdCPF = $t03470134853._4 | |
744 | 754 | let _direction = if ((oldPositionSize > 0)) | |
745 | 755 | then DIR_SHORT | |
746 | 756 | else DIR_LONG | |
747 | 757 | let isAdd = (_direction == DIR_LONG) | |
748 | 758 | let openNotional = muld(_amount, _leverage) | |
749 | - | let $ | |
750 | - | let oldPositionNotional = $ | |
751 | - | let unrealizedPnl = $ | |
752 | - | let $ | |
759 | + | let $t03502635142 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT) | |
760 | + | let oldPositionNotional = $t03502635142._1 | |
761 | + | let unrealizedPnl = $t03502635142._2 | |
762 | + | let $t03514837697 = if ((oldPositionNotional > openNotional)) | |
753 | 763 | then { | |
754 | - | let $ | |
755 | - | let exchangedPositionSize = $ | |
756 | - | let quoteAssetReserveAfter = $ | |
757 | - | let baseAssetReserveAfter = $ | |
758 | - | let totalPositionSizeAfter = $ | |
759 | - | let cumulativeNotionalAfter = $ | |
764 | + | let $t03552535744 = swapInput(isAdd, openNotional) | |
765 | + | let exchangedPositionSize = $t03552535744._1 | |
766 | + | let quoteAssetReserveAfter = $t03552535744._2 | |
767 | + | let baseAssetReserveAfter = $t03552535744._3 | |
768 | + | let totalPositionSizeAfter = $t03552535744._4 | |
769 | + | let cumulativeNotionalAfter = $t03552535744._5 | |
760 | 770 | let exchangedPositionSizeAbs = abs(exchangedPositionSize) | |
761 | 771 | if (if ((_minBaseAssetAmount != 0)) | |
762 | 772 | then (_minBaseAssetAmount > exchangedPositionSizeAbs) | |
764 | 774 | then throw(((("Too little base asset exchanged, got " + toString(exchangedPositionSizeAbs)) + " expected ") + toString(_minBaseAssetAmount))) | |
765 | 775 | else { | |
766 | 776 | let realizedPnl = divd(muld(unrealizedPnl, exchangedPositionSizeAbs), abs(oldPositionSize)) | |
767 | - | let $ | |
768 | - | let remainMargin = $ | |
769 | - | let badDebt = $ | |
770 | - | let fundingPayment = $ | |
777 | + | let $t03618136426 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl) | |
778 | + | let remainMargin = $t03618136426._1 | |
779 | + | let badDebt = $t03618136426._2 | |
780 | + | let fundingPayment = $t03618136426._3 | |
771 | 781 | let exchangedQuoteAssetAmount = openNotional | |
772 | 782 | let unrealizedPnlAfter = (unrealizedPnl - realizedPnl) | |
773 | 783 | let remainOpenNotional = if ((oldPositionSize > 0)) | |
782 | 792 | } | |
783 | 793 | } | |
784 | 794 | else throw("Close position first") | |
785 | - | let newPositionSize = $ | |
786 | - | let newPositionRemainMargin = $ | |
787 | - | let newPositionOpenNotional = $ | |
788 | - | let newPositionLatestCPF = $ | |
789 | - | let baseAssetReserveAfter = $ | |
790 | - | let quoteAssetReserveAfter = $ | |
791 | - | let totalPositionSizeAfter = $ | |
792 | - | let cumulativeNotionalAfter = $ | |
793 | - | let openInterestNotionalAfter = $ | |
794 | - | let totalLongAfter = $ | |
795 | - | let totalShortAfter = $ | |
795 | + | let newPositionSize = $t03514837697._1 | |
796 | + | let newPositionRemainMargin = $t03514837697._2 | |
797 | + | let newPositionOpenNotional = $t03514837697._3 | |
798 | + | let newPositionLatestCPF = $t03514837697._4 | |
799 | + | let baseAssetReserveAfter = $t03514837697._5 | |
800 | + | let quoteAssetReserveAfter = $t03514837697._6 | |
801 | + | let totalPositionSizeAfter = $t03514837697._7 | |
802 | + | let cumulativeNotionalAfter = $t03514837697._8 | |
803 | + | let openInterestNotionalAfter = $t03514837697._9 | |
804 | + | let totalLongAfter = $t03514837697._10 | |
805 | + | let totalShortAfter = $t03514837697._11 | |
796 | 806 | let notifyNotional = invoke(minerAddress(), "notifyNotional", [toString(i.caller), newPositionOpenNotional], nil) | |
797 | 807 | if ((notifyNotional == notifyNotional)) | |
798 | 808 | then (updatePosition(toString(i.caller), newPositionSize, newPositionRemainMargin, newPositionOpenNotional, newPositionLatestCPF) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter)) | |
821 | 831 | else { | |
822 | 832 | let feeAmount = muld(_rawAmount, fee()) | |
823 | 833 | let _amount = (_rawAmount - feeAmount) | |
824 | - | let $ | |
825 | - | let oldPositionSize = $ | |
826 | - | let oldPositionMargin = $ | |
827 | - | let oldPositionOpenNotional = $ | |
828 | - | let oldPositionLstUpdCPF = $ | |
834 | + | let $t03881538967 = getPosition(toString(i.caller)) | |
835 | + | let oldPositionSize = $t03881538967._1 | |
836 | + | let oldPositionMargin = $t03881538967._2 | |
837 | + | let oldPositionOpenNotional = $t03881538967._3 | |
838 | + | let oldPositionLstUpdCPF = $t03881538967._4 | |
829 | 839 | let isNewPosition = (oldPositionSize == 0) | |
830 | 840 | let isSameDirection = if ((oldPositionSize > 0)) | |
831 | 841 | then (_direction == DIR_LONG) | |
834 | 844 | then isSameDirection | |
835 | 845 | else false | |
836 | 846 | let isAdd = (_direction == DIR_LONG) | |
837 | - | let $ | |
847 | + | let $t03925641824 = if (if (isNewPosition) | |
838 | 848 | then true | |
839 | 849 | else expandExisting) | |
840 | 850 | then { | |
841 | 851 | let openNotional = muld(_amount, _leverage) | |
842 | - | let $ | |
843 | - | let amountBaseAssetBought = $ | |
844 | - | let quoteAssetReserveAfter = $ | |
845 | - | let baseAssetReserveAfter = $ | |
846 | - | let totalPositionSizeAfter = $ | |
847 | - | let cumulativeNotionalAfter = $ | |
852 | + | let $t03968039886 = swapInput(isAdd, openNotional) | |
853 | + | let amountBaseAssetBought = $t03968039886._1 | |
854 | + | let quoteAssetReserveAfter = $t03968039886._2 | |
855 | + | let baseAssetReserveAfter = $t03968039886._3 | |
856 | + | let totalPositionSizeAfter = $t03968039886._4 | |
857 | + | let cumulativeNotionalAfter = $t03968039886._5 | |
848 | 858 | if (if ((_minBaseAssetAmount != 0)) | |
849 | 859 | then (_minBaseAssetAmount > abs(amountBaseAssetBought)) | |
850 | 860 | else false) | |
852 | 862 | else { | |
853 | 863 | let newPositionSize = (oldPositionSize + amountBaseAssetBought) | |
854 | 864 | let increaseMarginRequirement = divd(openNotional, _leverage) | |
855 | - | let $ | |
856 | - | let remainMargin = $ | |
857 | - | let x1 = $ | |
858 | - | let x2 = $ | |
865 | + | let $t04026740506 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, increaseMarginRequirement) | |
866 | + | let remainMargin = $t04026740506._1 | |
867 | + | let x1 = $t04026740506._2 | |
868 | + | let x2 = $t04026740506._3 | |
859 | 869 | if (!(requireNotOverSpreadLimit(quoteAssetReserveAfter, baseAssetReserveAfter))) | |
860 | 870 | then throw("Over max spread limit") | |
861 | 871 | else $Tuple11(newPositionSize, remainMargin, (oldPositionOpenNotional + openNotional), latestCumulativePremiumFraction(newPositionSize), baseAssetReserveAfter, quoteAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, (openInterestNotional() + openNotional), (totalLongPositionSize() + (if ((newPositionSize > 0)) | |
867 | 877 | } | |
868 | 878 | else { | |
869 | 879 | let openNotional = muld(_amount, _leverage) | |
870 | - | let $ | |
871 | - | let oldPositionNotional = $ | |
872 | - | let unrealizedPnl = $ | |
880 | + | let $t04151741633 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT) | |
881 | + | let oldPositionNotional = $t04151741633._1 | |
882 | + | let unrealizedPnl = $t04151741633._2 | |
873 | 883 | if ((oldPositionNotional > openNotional)) | |
874 | 884 | then throw("Use decreasePosition to decrease position size") | |
875 | 885 | else throw("Close position first") | |
876 | 886 | } | |
877 | - | let newPositionSize = $ | |
878 | - | let newPositionRemainMargin = $ | |
879 | - | let newPositionOpenNotional = $ | |
880 | - | let newPositionLatestCPF = $ | |
881 | - | let baseAssetReserveAfter = $ | |
882 | - | let quoteAssetReserveAfter = $ | |
883 | - | let totalPositionSizeAfter = $ | |
884 | - | let cumulativeNotionalAfter = $ | |
885 | - | let openInterestNotionalAfter = $ | |
886 | - | let totalLongAfter = $ | |
887 | - | let totalShortAfter = $ | |
887 | + | let newPositionSize = $t03925641824._1 | |
888 | + | let newPositionRemainMargin = $t03925641824._2 | |
889 | + | let newPositionOpenNotional = $t03925641824._3 | |
890 | + | let newPositionLatestCPF = $t03925641824._4 | |
891 | + | let baseAssetReserveAfter = $t03925641824._5 | |
892 | + | let quoteAssetReserveAfter = $t03925641824._6 | |
893 | + | let totalPositionSizeAfter = $t03925641824._7 | |
894 | + | let cumulativeNotionalAfter = $t03925641824._8 | |
895 | + | let openInterestNotionalAfter = $t03925641824._9 | |
896 | + | let totalLongAfter = $t03925641824._10 | |
897 | + | let totalShortAfter = $t03925641824._11 | |
888 | 898 | let feeToStakers = (feeAmount / 2) | |
889 | 899 | let feeToInsurance = (feeAmount - feeToStakers) | |
890 | 900 | let stake = invoke(quoteAssetStaking(), "lockNeutrinoSP", [toString(stakingAddress()), ALL_FEES], [AttachedPayment(quoteAsset(), _amount)]) | |
925 | 935 | else { | |
926 | 936 | let feeAmount = muld(_rawAmount, fee()) | |
927 | 937 | let _amount = (_rawAmount - feeAmount) | |
928 | - | let $ | |
929 | - | let oldPositionSize = $ | |
930 | - | let oldPositionMargin = $ | |
931 | - | let oldPositionOpenNotional = $ | |
932 | - | let oldPositionLstUpdCPF = $ | |
938 | + | let $t04338043532 = getPosition(toString(i.caller)) | |
939 | + | let oldPositionSize = $t04338043532._1 | |
940 | + | let oldPositionMargin = $t04338043532._2 | |
941 | + | let oldPositionOpenNotional = $t04338043532._3 | |
942 | + | let oldPositionLstUpdCPF = $t04338043532._4 | |
933 | 943 | let feeToStakers = (feeAmount / 2) | |
934 | 944 | let feeToInsurance = (feeAmount - feeToStakers) | |
935 | 945 | let stake = invoke(quoteAssetStaking(), "lockNeutrinoSP", [toString(stakingAddress()), ALL_FEES], [AttachedPayment(quoteAsset(), _amount)]) | |
961 | 971 | else paused()) | |
962 | 972 | then throw("Invalid removeMargin parameters") | |
963 | 973 | else { | |
964 | - | let $ | |
965 | - | let oldPositionSize = $ | |
966 | - | let oldPositionMargin = $ | |
967 | - | let oldPositionOpenNotional = $ | |
968 | - | let oldPositionLstUpdCPF = $ | |
974 | + | let $t04458144733 = getPosition(toString(i.caller)) | |
975 | + | let oldPositionSize = $t04458144733._1 | |
976 | + | let oldPositionMargin = $t04458144733._2 | |
977 | + | let oldPositionOpenNotional = $t04458144733._3 | |
978 | + | let oldPositionLstUpdCPF = $t04458144733._4 | |
969 | 979 | let marginDelta = -(_amount) | |
970 | - | let $ | |
971 | - | let remainMargin = $ | |
972 | - | let badDebt = $ | |
980 | + | let $t04477044949 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, marginDelta) | |
981 | + | let remainMargin = $t04477044949._1 | |
982 | + | let badDebt = $t04477044949._2 | |
973 | 983 | if ((badDebt != 0)) | |
974 | 984 | then throw("Invalid removed margin amount") | |
975 | 985 | else { | |
988 | 998 | ||
989 | 999 | ||
990 | 1000 | @Callable(i) | |
991 | - | func closePosition () = if (if (if (!(requireOpenPosition(toString(i.caller)))) | |
992 | - | then true | |
993 | - | else !(initialized())) | |
994 | - | then true | |
995 | - | else paused()) | |
996 | - | then throw("Invalid closePosition parameters") | |
997 | - | else { | |
998 | - | let $t04553145921 = internalClosePosition(toString(i.caller), true) | |
999 | - | let x1 = $t04553145921._1 | |
1000 | - | let positionBadDebt = $t04553145921._2 | |
1001 | - | let realizedPnl = $t04553145921._3 | |
1002 | - | let marginToVault = $t04553145921._4 | |
1003 | - | let quoteAssetReserveAfter = $t04553145921._5 | |
1004 | - | let baseAssetReserveAfter = $t04553145921._6 | |
1005 | - | let totalPositionSizeAfter = $t04553145921._7 | |
1006 | - | let cumulativeNotionalAfter = $t04553145921._8 | |
1007 | - | let openInterestNotionalAfter = $t04553145921._9 | |
1008 | - | let x2 = $t04553145921._10 | |
1009 | - | let totalLongAfter = $t04553145921._11 | |
1010 | - | let totalShortAfter = $t04553145921._12 | |
1011 | - | if ((positionBadDebt > 0)) | |
1012 | - | then throw("Unable to close position with bad debt") | |
1013 | - | else { | |
1014 | - | let withdrawAmount = abs(marginToVault) | |
1015 | - | let ammBalance = (cbalance() - withdrawAmount) | |
1016 | - | let $t04613046272 = if ((0 > ammBalance)) | |
1017 | - | then $Tuple2(0, abs(ammBalance)) | |
1018 | - | else $Tuple2(ammBalance, 0) | |
1019 | - | let ammNewBalance = $t04613046272._1 | |
1020 | - | let getFromInsurance = $t04613046272._2 | |
1021 | - | let x = if ((getFromInsurance > 0)) | |
1022 | - | then { | |
1023 | - | let withdrawInsurance = invoke(insuranceAddress(), "withdraw", [getFromInsurance], nil) | |
1024 | - | if ((withdrawInsurance == withdrawInsurance)) | |
1025 | - | then nil | |
1026 | - | else throw("Strict value is not equal to itself.") | |
1027 | - | } | |
1028 | - | else nil | |
1029 | - | if ((x == x)) | |
1030 | - | then { | |
1031 | - | let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [(withdrawAmount - getFromInsurance), toBase58String(quoteAsset())], nil) | |
1032 | - | if ((unstake == unstake)) | |
1033 | - | then { | |
1034 | - | let notifyNotional = invoke(minerAddress(), "notifyNotional", [toString(i.caller), 0], nil) | |
1035 | - | if ((notifyNotional == notifyNotional)) | |
1036 | - | then (((deletePosition(toString(i.caller)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter)) ++ withdraw(i.caller, withdrawAmount)) ++ updateBalance(ammNewBalance)) | |
1037 | - | else throw("Strict value is not equal to itself.") | |
1038 | - | } | |
1039 | - | else throw("Strict value is not equal to itself.") | |
1040 | - | } | |
1041 | - | else throw("Strict value is not equal to itself.") | |
1042 | - | } | |
1043 | - | } | |
1001 | + | func closePosition () = { | |
1002 | + | let caller = getActualCaller(i) | |
1003 | + | let callerAddress = valueOrErrorMessage(addressFromString(caller), "Invalid caller") | |
1004 | + | if (if (if (!(requireOpenPosition(caller))) | |
1005 | + | then true | |
1006 | + | else !(initialized())) | |
1007 | + | then true | |
1008 | + | else paused()) | |
1009 | + | then throw("Invalid closePosition parameters") | |
1010 | + | else { | |
1011 | + | let $t04615246529 = internalClosePosition(caller, true) | |
1012 | + | let x1 = $t04615246529._1 | |
1013 | + | let positionBadDebt = $t04615246529._2 | |
1014 | + | let realizedPnl = $t04615246529._3 | |
1015 | + | let marginToVault = $t04615246529._4 | |
1016 | + | let quoteAssetReserveAfter = $t04615246529._5 | |
1017 | + | let baseAssetReserveAfter = $t04615246529._6 | |
1018 | + | let totalPositionSizeAfter = $t04615246529._7 | |
1019 | + | let cumulativeNotionalAfter = $t04615246529._8 | |
1020 | + | let openInterestNotionalAfter = $t04615246529._9 | |
1021 | + | let x2 = $t04615246529._10 | |
1022 | + | let totalLongAfter = $t04615246529._11 | |
1023 | + | let totalShortAfter = $t04615246529._12 | |
1024 | + | if ((positionBadDebt > 0)) | |
1025 | + | then throw("Unable to close position with bad debt") | |
1026 | + | else { | |
1027 | + | let withdrawAmount = abs(marginToVault) | |
1028 | + | let ammBalance = (cbalance() - withdrawAmount) | |
1029 | + | let $t04673846880 = if ((0 > ammBalance)) | |
1030 | + | then $Tuple2(0, abs(ammBalance)) | |
1031 | + | else $Tuple2(ammBalance, 0) | |
1032 | + | let ammNewBalance = $t04673846880._1 | |
1033 | + | let getFromInsurance = $t04673846880._2 | |
1034 | + | let x = if ((getFromInsurance > 0)) | |
1035 | + | then { | |
1036 | + | let withdrawInsurance = invoke(insuranceAddress(), "withdraw", [getFromInsurance], nil) | |
1037 | + | if ((withdrawInsurance == withdrawInsurance)) | |
1038 | + | then nil | |
1039 | + | else throw("Strict value is not equal to itself.") | |
1040 | + | } | |
1041 | + | else nil | |
1042 | + | if ((x == x)) | |
1043 | + | then { | |
1044 | + | let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [(withdrawAmount - getFromInsurance), toBase58String(quoteAsset())], nil) | |
1045 | + | if ((unstake == unstake)) | |
1046 | + | then { | |
1047 | + | let notifyNotional = invoke(minerAddress(), "notifyNotional", [caller, 0], nil) | |
1048 | + | if ((notifyNotional == notifyNotional)) | |
1049 | + | then (((deletePosition(caller) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter)) ++ withdraw(callerAddress, withdrawAmount)) ++ updateBalance(ammNewBalance)) | |
1050 | + | else throw("Strict value is not equal to itself.") | |
1051 | + | } | |
1052 | + | else throw("Strict value is not equal to itself.") | |
1053 | + | } | |
1054 | + | else throw("Strict value is not equal to itself.") | |
1055 | + | } | |
1056 | + | } | |
1057 | + | } | |
1044 | 1058 | ||
1045 | 1059 | ||
1046 | 1060 | ||
1067 | 1081 | then (DECIMAL_UNIT > partialLiquidationRatio()) | |
1068 | 1082 | else false) | |
1069 | 1083 | then { | |
1070 | - | let $ | |
1071 | - | let oldPositionSize = $ | |
1072 | - | let oldPositionMargin = $ | |
1073 | - | let oldPositionOpenNotional = $ | |
1074 | - | let oldPositionLstUpdCPF = $ | |
1084 | + | let $t04896049110 = getPosition(_trader) | |
1085 | + | let oldPositionSize = $t04896049110._1 | |
1086 | + | let oldPositionMargin = $t04896049110._2 | |
1087 | + | let oldPositionOpenNotional = $t04896049110._3 | |
1088 | + | let oldPositionLstUpdCPF = $t04896049110._4 | |
1075 | 1089 | let _direction = if ((oldPositionSize > 0)) | |
1076 | 1090 | then DIR_SHORT | |
1077 | 1091 | else DIR_LONG | |
1078 | 1092 | let isAdd = (_direction == DIR_LONG) | |
1079 | 1093 | let exchangedQuoteAssetAmount = getPartialLiquidationAmount(_trader, oldPositionSize) | |
1080 | - | let $ | |
1081 | - | let oldPositionNotional = $ | |
1082 | - | let unrealizedPnl = $ | |
1083 | - | let $ | |
1084 | - | let exchangedPositionSize = $ | |
1085 | - | let quoteAssetReserveAfter = $ | |
1086 | - | let baseAssetReserveAfter = $ | |
1087 | - | let totalPositionSizeAfter = $ | |
1088 | - | let cumulativeNotionalAfter = $ | |
1094 | + | let $t04933549439 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT) | |
1095 | + | let oldPositionNotional = $t04933549439._1 | |
1096 | + | let unrealizedPnl = $t04933549439._2 | |
1097 | + | let $t04944749737 = swapInput(isAdd, exchangedQuoteAssetAmount) | |
1098 | + | let exchangedPositionSize = $t04944749737._1 | |
1099 | + | let quoteAssetReserveAfter = $t04944749737._2 | |
1100 | + | let baseAssetReserveAfter = $t04944749737._3 | |
1101 | + | let totalPositionSizeAfter = $t04944749737._4 | |
1102 | + | let cumulativeNotionalAfter = $t04944749737._5 | |
1089 | 1103 | let realizedPnl = divd(muld(unrealizedPnl, abs(exchangedPositionSize)), abs(oldPositionSize)) | |
1090 | - | let $ | |
1091 | - | let remainMargin = $ | |
1092 | - | let badDebt = $ | |
1093 | - | let fundingPayment = $ | |
1104 | + | let $t04984450077 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl) | |
1105 | + | let remainMargin = $t04984450077._1 | |
1106 | + | let badDebt = $t04984450077._2 | |
1107 | + | let fundingPayment = $t04984450077._3 | |
1094 | 1108 | let unrealizedPnlAfter = (unrealizedPnl - realizedPnl) | |
1095 | 1109 | let remainOpenNotional = if ((oldPositionSize > 0)) | |
1096 | 1110 | then ((oldPositionNotional - exchangedQuoteAssetAmount) - unrealizedPnlAfter) | |
1104 | 1118 | let newPositionLstUpdCPF = latestCumulativePremiumFraction(newPositionSize) | |
1105 | 1119 | let openInterestNotionalAfter = (openInterestNotional() - exchangedQuoteAssetAmount) | |
1106 | 1120 | let ammBalance = (cbalance() - liquidationPenalty) | |
1107 | - | let $ | |
1121 | + | let $t05125051393 = if ((0 > ammBalance)) | |
1108 | 1122 | then $Tuple2(0, abs(ammBalance)) | |
1109 | 1123 | else $Tuple2(ammBalance, 0) | |
1110 | - | let newAmmBalance = $ | |
1111 | - | let takeFromInsurance = $ | |
1124 | + | let newAmmBalance = $t05125051393._1 | |
1125 | + | let takeFromInsurance = $t05125051393._2 | |
1112 | 1126 | let x = if ((takeFromInsurance > 0)) | |
1113 | 1127 | then { | |
1114 | 1128 | let withdrawInsurance = invoke(insuranceAddress(), "withdraw", [takeFromInsurance], nil) | |
1141 | 1155 | else throw("Strict value is not equal to itself.") | |
1142 | 1156 | } | |
1143 | 1157 | else { | |
1144 | - | let $ | |
1145 | - | let x1 = $ | |
1146 | - | let badDebt = $ | |
1147 | - | let x2 = $ | |
1148 | - | let x3 = $ | |
1149 | - | let quoteAssetReserveAfter = $ | |
1150 | - | let baseAssetReserveAfter = $ | |
1151 | - | let totalPositionSizeAfter = $ | |
1152 | - | let cumulativeNotionalAfter = $ | |
1153 | - | let openInterestNotionalAfter = $ | |
1154 | - | let exchangedQuoteAssetAmount = $ | |
1155 | - | let totalLongAfter = $ | |
1156 | - | let totalShortAfter = $ | |
1158 | + | let $t05284953304 = internalClosePosition(_trader, false) | |
1159 | + | let x1 = $t05284953304._1 | |
1160 | + | let badDebt = $t05284953304._2 | |
1161 | + | let x2 = $t05284953304._3 | |
1162 | + | let x3 = $t05284953304._4 | |
1163 | + | let quoteAssetReserveAfter = $t05284953304._5 | |
1164 | + | let baseAssetReserveAfter = $t05284953304._6 | |
1165 | + | let totalPositionSizeAfter = $t05284953304._7 | |
1166 | + | let cumulativeNotionalAfter = $t05284953304._8 | |
1167 | + | let openInterestNotionalAfter = $t05284953304._9 | |
1168 | + | let exchangedQuoteAssetAmount = $t05284953304._10 | |
1169 | + | let totalLongAfter = $t05284953304._11 | |
1170 | + | let totalShortAfter = $t05284953304._12 | |
1157 | 1171 | let liquidationPenalty = muld(exchangedQuoteAssetAmount, liquidationFeeRatio()) | |
1158 | 1172 | let feeToLiquidator = (liquidationPenalty / 2) | |
1159 | 1173 | let feeToInsurance = (liquidationPenalty - feeToLiquidator) | |
1160 | 1174 | let ammBalance = (cbalance() - liquidationPenalty) | |
1161 | - | let $ | |
1175 | + | let $t05371653859 = if ((0 > ammBalance)) | |
1162 | 1176 | then $Tuple2(0, abs(ammBalance)) | |
1163 | 1177 | else $Tuple2(ammBalance, 0) | |
1164 | - | let newAmmBalance = $ | |
1165 | - | let takeFromInsurance = $ | |
1178 | + | let newAmmBalance = $t05371653859._1 | |
1179 | + | let takeFromInsurance = $t05371653859._2 | |
1166 | 1180 | let x = if ((takeFromInsurance > 0)) | |
1167 | 1181 | then { | |
1168 | 1182 | let withdrawInsurance = invoke(insuranceAddress(), "withdraw", [takeFromInsurance], nil) | |
1207 | 1221 | let underlyingPrice = getOracleTwapPrice() | |
1208 | 1222 | let spotTwapPrice = getTwapSpotPrice() | |
1209 | 1223 | let premium = (spotTwapPrice - underlyingPrice) | |
1210 | - | let $ | |
1224 | + | let $t05544756782 = if (if ((totalShortPositionSize() == 0)) | |
1211 | 1225 | then true | |
1212 | 1226 | else (totalLongPositionSize() == 0)) | |
1213 | 1227 | then $Tuple2(0, 0) | |
1222 | 1236 | let shortPremiumFraction = divd(muld(longPremiumFraction, totalLongPositionSize()), totalShortPositionSize()) | |
1223 | 1237 | $Tuple2(shortPremiumFraction, longPremiumFraction) | |
1224 | 1238 | } | |
1225 | - | let shortPremiumFraction = $ | |
1226 | - | let longPremiumFraction = $ | |
1239 | + | let shortPremiumFraction = $t05544756782._1 | |
1240 | + | let longPremiumFraction = $t05544756782._2 | |
1227 | 1241 | updateFunding((fundingBlockTimestamp + fundingPeriodSeconds()), (latestLongCumulativePremiumFraction() + longPremiumFraction), (latestShortCumulativePremiumFraction() + shortPremiumFraction), divd(longPremiumFraction, underlyingPrice), divd(shortPremiumFraction, underlyingPrice)) | |
1228 | 1242 | } | |
1229 | 1243 | } | |
1232 | 1246 | ||
1233 | 1247 | @Callable(i) | |
1234 | 1248 | func v_get (_trader) = { | |
1235 | - | let $ | |
1236 | - | let x1 = $ | |
1237 | - | let x2 = $ | |
1238 | - | let x3 = $ | |
1239 | - | let x4 = $ | |
1249 | + | let $t05715757217 = internalClosePosition(_trader, false) | |
1250 | + | let x1 = $t05715757217._1 | |
1251 | + | let x2 = $t05715757217._2 | |
1252 | + | let x3 = $t05715757217._3 | |
1253 | + | let x4 = $t05715757217._4 | |
1240 | 1254 | throw((((s(x2) + s(x3)) + s(x4)) + s(getMarginRatio(_trader)))) | |
1241 | 1255 | } | |
1242 | 1256 | ||
1244 | 1258 | ||
1245 | 1259 | @Callable(i) | |
1246 | 1260 | func view_calcRemainMarginWithFundingPayment (_trader) = { | |
1247 | - | let $ | |
1248 | - | let positionSize = $ | |
1249 | - | let positionMargin = $ | |
1250 | - | let pon = $ | |
1251 | - | let positionLstUpdCPF = $ | |
1252 | - | let $ | |
1253 | - | let positionNotional = $ | |
1254 | - | let unrealizedPnl = $ | |
1255 | - | let $ | |
1256 | - | let remainMargin = $ | |
1257 | - | let badDebt = $ | |
1258 | - | let fundingPayment = $ | |
1261 | + | let $t05736457475 = getPosition(_trader) | |
1262 | + | let positionSize = $t05736457475._1 | |
1263 | + | let positionMargin = $t05736457475._2 | |
1264 | + | let pon = $t05736457475._3 | |
1265 | + | let positionLstUpdCPF = $t05736457475._4 | |
1266 | + | let $t05748057581 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT) | |
1267 | + | let positionNotional = $t05748057581._1 | |
1268 | + | let unrealizedPnl = $t05748057581._2 | |
1269 | + | let $t05758657768 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl) | |
1270 | + | let remainMargin = $t05758657768._1 | |
1271 | + | let badDebt = $t05758657768._2 | |
1272 | + | let fundingPayment = $t05758657768._3 | |
1259 | 1273 | throw((((((s(remainMargin) + s(fundingPayment)) + s(getMarginRatio(_trader))) + s(unrealizedPnl)) + s(badDebt)) + s(positionNotional))) | |
1260 | 1274 | } | |
1261 | 1275 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let k_ora_key = "k_ora_key" | |
5 | 5 | ||
6 | 6 | let k_ora_block_key = "k_ora_block_key" | |
7 | 7 | ||
8 | 8 | let k_ora = "k_ora" | |
9 | 9 | ||
10 | 10 | let k_balance = "k_balance" | |
11 | 11 | ||
12 | 12 | let k_positionSize = "k_positionSize" | |
13 | 13 | ||
14 | 14 | let k_positionMargin = "k_positionMargin" | |
15 | 15 | ||
16 | 16 | let k_positionOpenNotional = "k_positionOpenNotional" | |
17 | 17 | ||
18 | 18 | let k_positionLastUpdatedCumulativePremiumFraction = "k_positionFraction" | |
19 | + | ||
20 | + | let k_positionClosedDate = "k_positionClosedDate" | |
19 | 21 | ||
20 | 22 | let k_initialized = "k_initialized" | |
21 | 23 | ||
22 | 24 | let k_paused = "k_paused" | |
23 | 25 | ||
24 | 26 | let k_fee = "k_fee" | |
25 | 27 | ||
26 | 28 | let k_fundingPeriod = "k_fundingPeriod" | |
27 | 29 | ||
28 | 30 | let k_initMarginRatio = "k_initMarginRatio" | |
29 | 31 | ||
30 | 32 | let k_maintenanceMarginRatio = "k_mmr" | |
31 | 33 | ||
32 | 34 | let k_liquidationFeeRatio = "k_liquidationFeeRatio" | |
33 | 35 | ||
34 | 36 | let k_partialLiquidationRatio = "k_partLiquidationRatio" | |
35 | 37 | ||
36 | 38 | let k_spreadLimit = "k_spreadLimit" | |
37 | 39 | ||
38 | 40 | let k_maxPriceImpact = "k_maxPriceImpact" | |
39 | 41 | ||
40 | 42 | let k_maxPriceSpread = "k_maxPriceSpread" | |
41 | 43 | ||
42 | 44 | let k_lastDataStr = "k_lastDataStr" | |
43 | 45 | ||
44 | 46 | let k_lastMinuteId = "k_lastMinuteId" | |
45 | 47 | ||
46 | 48 | let k_twapDataLastCumulativePrice = "k_twapDataLastCumulativePrice" | |
47 | 49 | ||
48 | 50 | let k_twapDataLastPrice = "k_twapDataLastPrice" | |
49 | 51 | ||
50 | 52 | let k_twapDataPreviousMinuteId = "k_twapDataPreviousMinuteId" | |
51 | 53 | ||
52 | 54 | let k_latestLongCumulativePremiumFraction = "k_latestLongPremiumFraction" | |
53 | 55 | ||
54 | 56 | let k_latestShortCumulativePremiumFraction = "k_latestShortPremiumFraction" | |
55 | 57 | ||
56 | 58 | let k_nextFundingBlock = "k_nextFundingBlockMinTimestamp" | |
57 | 59 | ||
58 | 60 | let k_longFundingRate = "k_longFundingRate" | |
59 | 61 | ||
60 | 62 | let k_shortFundingRate = "k_shortFundingRate" | |
61 | 63 | ||
62 | 64 | let k_quoteAssetReserve = "k_qtAstR" | |
63 | 65 | ||
64 | 66 | let k_baseAssetReserve = "k_bsAstR" | |
65 | 67 | ||
66 | 68 | let k_totalPositionSize = "k_totalPositionSize" | |
67 | 69 | ||
68 | 70 | let k_totalLongPositionSize = "k_totalLongPositionSize" | |
69 | 71 | ||
70 | 72 | let k_totalShortPositionSize = "k_totalShortPositionSize" | |
71 | 73 | ||
72 | 74 | let k_cumulativeNotional = "k_cumulativeNotional" | |
73 | 75 | ||
74 | 76 | let k_openInterestNotional = "k_openInterestNotional" | |
75 | 77 | ||
76 | 78 | let k_coordinatorAddress = "k_coordinatorAddress" | |
77 | 79 | ||
78 | 80 | let k_insurance_address = "k_insurance_address" | |
79 | 81 | ||
80 | 82 | let k_admin_address = "k_admin_address" | |
81 | 83 | ||
82 | 84 | let k_admin_public_key = "k_admin_public_key" | |
83 | 85 | ||
84 | 86 | let k_quote_asset = "k_quote_asset" | |
85 | 87 | ||
86 | 88 | let k_quote_staking = "k_quote_staking" | |
87 | 89 | ||
88 | 90 | let k_staking_address = "k_staking_address" | |
89 | 91 | ||
90 | 92 | let k_miner_address = "k_miner_address" | |
91 | 93 | ||
94 | + | let k_orders_address = "k_orders_address" | |
95 | + | ||
92 | 96 | func coordinator () = valueOrErrorMessage(addressFromString(getStringValue(this, k_coordinatorAddress)), "Coordinator not set") | |
93 | 97 | ||
94 | 98 | ||
95 | 99 | func adminAddress () = addressFromString(getStringValue(coordinator(), k_admin_address)) | |
96 | 100 | ||
97 | 101 | ||
98 | 102 | func adminPublicKey () = fromBase58String(getStringValue(coordinator(), k_admin_public_key)) | |
99 | 103 | ||
100 | 104 | ||
101 | 105 | func quoteAsset () = fromBase58String(getStringValue(coordinator(), k_quote_asset)) | |
102 | 106 | ||
103 | 107 | ||
104 | 108 | func quoteAssetStaking () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_quote_staking)), "Quote asset staking not set") | |
105 | 109 | ||
106 | 110 | ||
107 | - | func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), " | |
111 | + | func stakingAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_staking_address)), "Staking not set") | |
108 | 112 | ||
109 | 113 | ||
110 | 114 | func insuranceAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_insurance_address)), "Insurance not set") | |
111 | 115 | ||
112 | 116 | ||
113 | - | func minerAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_miner_address)), "Insurance not set") | |
117 | + | func minerAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_miner_address)), "Miner not set") | |
118 | + | ||
119 | + | ||
120 | + | func ordersAddress () = valueOrErrorMessage(addressFromString(getStringValue(coordinator(), k_orders_address)), "Orders not set") | |
114 | 121 | ||
115 | 122 | ||
116 | 123 | let DIR_LONG = 1 | |
117 | 124 | ||
118 | 125 | let DIR_SHORT = 2 | |
119 | 126 | ||
120 | 127 | let TWAP_INTERVAL = 15 | |
121 | 128 | ||
122 | 129 | let ORACLE_INTERVAL = 15 | |
123 | 130 | ||
124 | 131 | let SECONDS = 1000 | |
125 | 132 | ||
126 | 133 | let DECIMAL_UNIT = (1 * (((((10 * 10) * 10) * 10) * 10) * 10)) | |
127 | 134 | ||
128 | 135 | let ONE_DAY = (86400 * DECIMAL_UNIT) | |
129 | 136 | ||
130 | 137 | let ALL_FEES = 100 | |
131 | 138 | ||
132 | 139 | let PNL_OPTION_SPOT = 1 | |
133 | 140 | ||
134 | 141 | let PNL_OPTION_ORACLE = 2 | |
135 | 142 | ||
136 | 143 | func s (_x) = (toString(_x) + ",") | |
137 | 144 | ||
138 | 145 | ||
139 | 146 | func divd (_x,_y) = fraction(_x, DECIMAL_UNIT, _y, HALFEVEN) | |
140 | 147 | ||
141 | 148 | ||
142 | 149 | func muld (_x,_y) = fraction(_x, _y, DECIMAL_UNIT, HALFEVEN) | |
143 | 150 | ||
144 | 151 | ||
145 | 152 | func abs (_x) = if ((_x > 0)) | |
146 | 153 | then _x | |
147 | 154 | else -(_x) | |
148 | 155 | ||
149 | 156 | ||
150 | 157 | func vmax (_x,_y) = if ((_x >= _y)) | |
151 | 158 | then _x | |
152 | 159 | else _y | |
153 | 160 | ||
154 | 161 | ||
155 | 162 | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
156 | 163 | ||
157 | 164 | ||
158 | 165 | func listToStr (_list) = { | |
159 | 166 | func _join (accumulator,val) = ((accumulator + val) + ",") | |
160 | 167 | ||
161 | 168 | let newListStr = { | |
162 | 169 | let $l = _list | |
163 | 170 | let $s = size($l) | |
164 | 171 | let $acc0 = "" | |
165 | 172 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
166 | 173 | then $a | |
167 | 174 | else _join($a, $l[$i]) | |
168 | 175 | ||
169 | 176 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
170 | 177 | then $a | |
171 | 178 | else throw("List size exceeds 20") | |
172 | 179 | ||
173 | 180 | $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) | |
174 | 181 | } | |
175 | 182 | let newListStrU = dropRight(newListStr, 1) | |
176 | 183 | let newListStrR = if ((take(newListStrU, 1) == ",")) | |
177 | 184 | then drop(newListStrU, 1) | |
178 | 185 | else newListStrU | |
179 | 186 | newListStrR | |
180 | 187 | } | |
181 | 188 | ||
182 | 189 | ||
183 | 190 | func strToList (_str) = split(_str, ",") | |
184 | 191 | ||
185 | 192 | ||
186 | 193 | func pushToQueue (_list,_maxSize,_value) = if ((size(_list) > _maxSize)) | |
187 | 194 | then (removeByIndex(_list, 0) :+ _value) | |
188 | 195 | else (_list :+ _value) | |
189 | 196 | ||
190 | 197 | ||
191 | 198 | func int (k) = valueOrErrorMessage(getInteger(this, k), ("no value for " + k)) | |
192 | 199 | ||
193 | 200 | ||
194 | 201 | func cbalance () = int(k_balance) | |
195 | 202 | ||
196 | 203 | ||
197 | 204 | func fee () = int(k_fee) | |
198 | 205 | ||
199 | 206 | ||
200 | 207 | func initMarginRatio () = int(k_initMarginRatio) | |
201 | 208 | ||
202 | 209 | ||
203 | 210 | func qtAstR () = int(k_quoteAssetReserve) | |
204 | 211 | ||
205 | 212 | ||
206 | 213 | func bsAstR () = int(k_baseAssetReserve) | |
207 | 214 | ||
208 | 215 | ||
209 | 216 | func totalPositionSize () = int(k_totalPositionSize) | |
210 | 217 | ||
211 | 218 | ||
212 | 219 | func cumulativeNotional () = int(k_cumulativeNotional) | |
213 | 220 | ||
214 | 221 | ||
215 | 222 | func openInterestNotional () = int(k_openInterestNotional) | |
216 | 223 | ||
217 | 224 | ||
218 | 225 | func nextFundingBlockTimestamp () = int(k_nextFundingBlock) | |
219 | 226 | ||
220 | 227 | ||
221 | 228 | func fundingPeriodRaw () = int(k_fundingPeriod) | |
222 | 229 | ||
223 | 230 | ||
224 | 231 | func fundingPeriodDecimal () = (fundingPeriodRaw() * DECIMAL_UNIT) | |
225 | 232 | ||
226 | 233 | ||
227 | 234 | func fundingPeriodSeconds () = (fundingPeriodRaw() * SECONDS) | |
228 | 235 | ||
229 | 236 | ||
230 | 237 | func maintenanceMarginRatio () = int(k_maintenanceMarginRatio) | |
231 | 238 | ||
232 | 239 | ||
233 | 240 | func liquidationFeeRatio () = int(k_liquidationFeeRatio) | |
234 | 241 | ||
235 | 242 | ||
236 | 243 | func partialLiquidationRatio () = int(k_partialLiquidationRatio) | |
237 | 244 | ||
238 | 245 | ||
239 | 246 | func spreadLimit () = int(k_spreadLimit) | |
240 | 247 | ||
241 | 248 | ||
242 | 249 | func maxPriceImpact () = int(k_maxPriceImpact) | |
243 | 250 | ||
244 | 251 | ||
245 | 252 | func maxPriceSpread () = int(k_maxPriceSpread) | |
246 | 253 | ||
247 | 254 | ||
248 | 255 | func latestLongCumulativePremiumFraction () = int(k_latestLongCumulativePremiumFraction) | |
249 | 256 | ||
250 | 257 | ||
251 | 258 | func latestShortCumulativePremiumFraction () = int(k_latestShortCumulativePremiumFraction) | |
252 | 259 | ||
253 | 260 | ||
254 | 261 | func totalShortPositionSize () = int(k_totalShortPositionSize) | |
255 | 262 | ||
256 | 263 | ||
257 | 264 | func totalLongPositionSize () = int(k_totalLongPositionSize) | |
258 | 265 | ||
259 | 266 | ||
267 | + | func getActualCaller (i) = valueOrElse(getString(ordersAddress(), "k_sender"), toString(i.caller)) | |
268 | + | ||
269 | + | ||
260 | 270 | func requireMoreMarginRatio (_marginRatio,_baseMarginRatio,_largerThanOrEqualTo) = { | |
261 | 271 | let remainingMarginRatio = (_marginRatio - _baseMarginRatio) | |
262 | 272 | if (if (_largerThanOrEqualTo) | |
263 | 273 | then (0 > remainingMarginRatio) | |
264 | 274 | else false) | |
265 | 275 | then throw("Invalid margin") | |
266 | 276 | else if (if (!(_largerThanOrEqualTo)) | |
267 | 277 | then (remainingMarginRatio >= 0) | |
268 | 278 | else false) | |
269 | 279 | then throw("Invalid margin") | |
270 | 280 | else true | |
271 | 281 | } | |
272 | 282 | ||
273 | 283 | ||
274 | 284 | func latestCumulativePremiumFraction (_positionSize) = if ((_positionSize == 0)) | |
275 | 285 | then throw("Should not be called with _positionSize == 0") | |
276 | 286 | else if ((_positionSize > 0)) | |
277 | 287 | then latestLongCumulativePremiumFraction() | |
278 | 288 | else latestShortCumulativePremiumFraction() | |
279 | 289 | ||
280 | 290 | ||
281 | 291 | func getPosition (_trader) = { | |
282 | 292 | let positionSizeOpt = getInteger(this, toCompositeKey(k_positionSize, _trader)) | |
283 | 293 | match positionSizeOpt { | |
284 | 294 | case positionSize: Int => | |
285 | 295 | $Tuple4(positionSize, getIntegerValue(this, toCompositeKey(k_positionMargin, _trader)), getIntegerValue(this, toCompositeKey(k_positionOpenNotional, _trader)), getIntegerValue(this, toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _trader))) | |
286 | 296 | case _ => | |
287 | 297 | $Tuple4(0, 0, 0, 0) | |
288 | 298 | } | |
289 | 299 | } | |
290 | 300 | ||
291 | 301 | ||
292 | 302 | func requireOpenPosition (_trader) = if ((getPosition(_trader)._1 == 0)) | |
293 | 303 | then throw("No open position") | |
294 | 304 | else true | |
295 | 305 | ||
296 | 306 | ||
297 | 307 | func initialized () = valueOrElse(getBoolean(this, k_initialized), false) | |
298 | 308 | ||
299 | 309 | ||
300 | 310 | func paused () = valueOrElse(getBoolean(this, k_paused), false) | |
301 | 311 | ||
302 | 312 | ||
303 | 313 | func updateReserve (_isAdd,_quoteAssetAmount,_baseAssetAmount) = if (_isAdd) | |
304 | 314 | then { | |
305 | 315 | let newBase = (bsAstR() - _baseAssetAmount) | |
306 | 316 | if ((0 >= newBase)) | |
307 | 317 | then throw("Tx lead to base asset reserve <= 0, revert") | |
308 | 318 | else $Tuple4((qtAstR() + _quoteAssetAmount), newBase, (totalPositionSize() + _baseAssetAmount), (cumulativeNotional() + _quoteAssetAmount)) | |
309 | 319 | } | |
310 | 320 | else { | |
311 | 321 | let newQuote = (qtAstR() - _quoteAssetAmount) | |
312 | 322 | if ((0 >= newQuote)) | |
313 | 323 | then throw("Tx lead to base quote reserve <= 0, revert") | |
314 | 324 | else $Tuple4(newQuote, (bsAstR() + _baseAssetAmount), (totalPositionSize() - _baseAssetAmount), (cumulativeNotional() - _quoteAssetAmount)) | |
315 | 325 | } | |
316 | 326 | ||
317 | 327 | ||
318 | 328 | func swapInput (_isAdd,_quoteAssetAmount) = { | |
319 | 329 | let _qtAstR = qtAstR() | |
320 | 330 | let _bsAstR = bsAstR() | |
321 | 331 | let k = muld(_qtAstR, _bsAstR) | |
322 | 332 | let quoteAssetReserveAfter = if (_isAdd) | |
323 | 333 | then (_qtAstR + _quoteAssetAmount) | |
324 | 334 | else (_qtAstR - _quoteAssetAmount) | |
325 | 335 | let baseAssetReserveAfter = divd(k, quoteAssetReserveAfter) | |
326 | 336 | let amountBaseAssetBoughtAbs = abs((baseAssetReserveAfter - _bsAstR)) | |
327 | 337 | let amountBaseAssetBought = if (_isAdd) | |
328 | 338 | then amountBaseAssetBoughtAbs | |
329 | 339 | else -(amountBaseAssetBoughtAbs) | |
330 | - | let $ | |
331 | - | let quoteAssetReserveAfter1 = $ | |
332 | - | let baseAssetReserveAfter1 = $ | |
333 | - | let totalPositionSizeAfter1 = $ | |
334 | - | let cumulativeNotionalAfter1 = $ | |
340 | + | let $t01260512798 = updateReserve(_isAdd, _quoteAssetAmount, amountBaseAssetBoughtAbs) | |
341 | + | let quoteAssetReserveAfter1 = $t01260512798._1 | |
342 | + | let baseAssetReserveAfter1 = $t01260512798._2 | |
343 | + | let totalPositionSizeAfter1 = $t01260512798._3 | |
344 | + | let cumulativeNotionalAfter1 = $t01260512798._4 | |
335 | 345 | let priceBefore = divd(_qtAstR, _bsAstR) | |
336 | 346 | let marketPrice = divd(_quoteAssetAmount, amountBaseAssetBoughtAbs) | |
337 | 347 | let priceDiff = abs((priceBefore - marketPrice)) | |
338 | 348 | let priceImpact = (DECIMAL_UNIT - divd(priceBefore, (priceBefore + priceDiff))) | |
339 | 349 | let maxPriceImpactValue = maxPriceImpact() | |
340 | 350 | if ((priceImpact > maxPriceImpactValue)) | |
341 | 351 | 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))) | |
342 | 352 | else $Tuple5(amountBaseAssetBought, quoteAssetReserveAfter1, baseAssetReserveAfter1, totalPositionSizeAfter1, cumulativeNotionalAfter1) | |
343 | 353 | } | |
344 | 354 | ||
345 | 355 | ||
346 | 356 | func calcRemainMarginWithFundingPayment (_oldPositionSize,_oldPositionMargin,_oldPositionCumulativePremiumFraction,_marginDelta) = { | |
347 | 357 | let fundingPayment = if ((_oldPositionSize != 0)) | |
348 | 358 | then { | |
349 | 359 | let _latestCumulativePremiumFraction = latestCumulativePremiumFraction(_oldPositionSize) | |
350 | 360 | muld((_latestCumulativePremiumFraction - _oldPositionCumulativePremiumFraction), _oldPositionSize) | |
351 | 361 | } | |
352 | 362 | else 0 | |
353 | 363 | let signedMargin = ((_marginDelta - fundingPayment) + _oldPositionMargin) | |
354 | - | let $ | |
364 | + | let $t01428914416 = if ((0 > signedMargin)) | |
355 | 365 | then $Tuple2(0, abs(signedMargin)) | |
356 | 366 | else $Tuple2(abs(signedMargin), 0) | |
357 | - | let remainMargin = $ | |
358 | - | let badDebt = $ | |
367 | + | let remainMargin = $t01428914416._1 | |
368 | + | let badDebt = $t01428914416._2 | |
359 | 369 | $Tuple3(remainMargin, badDebt, fundingPayment) | |
360 | 370 | } | |
361 | 371 | ||
362 | 372 | ||
363 | 373 | func swapOutputWithReserves (_isAdd,_baseAssetAmount,_checkMaxPriceImpact,_quoteAssetReserve,_baseAssetReserve) = { | |
364 | 374 | let priceBefore = divd(_quoteAssetReserve, _baseAssetReserve) | |
365 | 375 | if ((_baseAssetAmount == 0)) | |
366 | 376 | then throw("Invalid base asset amount") | |
367 | 377 | else { | |
368 | 378 | let k = muld(_quoteAssetReserve, _baseAssetReserve) | |
369 | 379 | let baseAssetPoolAmountAfter = if (_isAdd) | |
370 | 380 | then (_baseAssetReserve + _baseAssetAmount) | |
371 | 381 | else (_baseAssetReserve - _baseAssetAmount) | |
372 | 382 | let quoteAssetAfter = divd(k, baseAssetPoolAmountAfter) | |
373 | 383 | let quoteAssetSold = abs((quoteAssetAfter - _quoteAssetReserve)) | |
374 | 384 | let maxPriceImpactValue = maxPriceImpact() | |
375 | - | let $ | |
376 | - | let quoteAssetReserveAfter1 = $ | |
377 | - | let baseAssetReserveAfter1 = $ | |
378 | - | let totalPositionSizeAfter1 = $ | |
379 | - | let cumulativeNotionalAfter1 = $ | |
385 | + | let $t01539315586 = updateReserve(!(_isAdd), quoteAssetSold, _baseAssetAmount) | |
386 | + | let quoteAssetReserveAfter1 = $t01539315586._1 | |
387 | + | let baseAssetReserveAfter1 = $t01539315586._2 | |
388 | + | let totalPositionSizeAfter1 = $t01539315586._3 | |
389 | + | let cumulativeNotionalAfter1 = $t01539315586._4 | |
380 | 390 | let marketPrice = divd(quoteAssetSold, _baseAssetAmount) | |
381 | 391 | let priceDiff = abs((priceBefore - marketPrice)) | |
382 | 392 | let priceImpact = (DECIMAL_UNIT - divd(priceBefore, (priceBefore + priceDiff))) | |
383 | 393 | if (if ((priceImpact > maxPriceImpactValue)) | |
384 | 394 | then _checkMaxPriceImpact | |
385 | 395 | else false) | |
386 | 396 | 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))) | |
387 | 397 | else $Tuple8(quoteAssetSold, quoteAssetReserveAfter1, baseAssetReserveAfter1, totalPositionSizeAfter1, cumulativeNotionalAfter1, (totalLongPositionSize() - (if (_isAdd) | |
388 | 398 | then abs(_baseAssetAmount) | |
389 | 399 | else 0)), (totalShortPositionSize() - (if (!(_isAdd)) | |
390 | 400 | then abs(_baseAssetAmount) | |
391 | 401 | else 0)), priceImpact) | |
392 | 402 | } | |
393 | 403 | } | |
394 | 404 | ||
395 | 405 | ||
396 | 406 | func swapOutput (_isAdd,_baseAssetAmount,_checkMaxPriceImpact) = swapOutputWithReserves(_isAdd, _baseAssetAmount, _checkMaxPriceImpact, qtAstR(), bsAstR()) | |
397 | 407 | ||
398 | 408 | ||
399 | 409 | func getOracleTwapPrice () = { | |
400 | 410 | let oracle = valueOrErrorMessage(addressFromString(getStringValue(this, k_ora)), "") | |
401 | 411 | let priceKey = getStringValue(this, k_ora_key) | |
402 | 412 | let blockKey = getStringValue(this, k_ora_block_key) | |
403 | 413 | let lastValue = valueOrErrorMessage(getInteger(oracle, priceKey), ((("Can not get oracle price. Oracle: " + toString(oracle)) + " key: ") + priceKey)) | |
404 | 414 | lastValue | |
405 | 415 | } | |
406 | 416 | ||
407 | 417 | ||
408 | 418 | func requireNotOverSpreadLimit (_quoteAssetReserve,_baseAssetReserve) = { | |
409 | 419 | let oraclePrice = getOracleTwapPrice() | |
410 | 420 | let priceAfter = divd(_quoteAssetReserve, _baseAssetReserve) | |
411 | 421 | let averagePrice = divd((oraclePrice + priceAfter), (2 * DECIMAL_UNIT)) | |
412 | 422 | let absPriceDiff = divd(abs((oraclePrice - priceAfter)), averagePrice) | |
413 | 423 | if ((absPriceDiff > maxPriceSpread())) | |
414 | 424 | then throw(((("Price spread " + toString(absPriceDiff)) + " > max price spread ") + toString(maxPriceSpread()))) | |
415 | 425 | else true | |
416 | 426 | } | |
417 | 427 | ||
418 | 428 | ||
419 | 429 | func getSpotPrice () = { | |
420 | 430 | let _quoteAssetReserve = qtAstR() | |
421 | 431 | let _baseAssetReserve = bsAstR() | |
422 | 432 | divd(_quoteAssetReserve, _baseAssetReserve) | |
423 | 433 | } | |
424 | 434 | ||
425 | 435 | ||
426 | 436 | func isOverFluctuationLimit () = { | |
427 | 437 | let oraclePrice = getOracleTwapPrice() | |
428 | 438 | let currentPrice = getSpotPrice() | |
429 | 439 | (divd(abs((oraclePrice - currentPrice)), oraclePrice) > spreadLimit()) | |
430 | 440 | } | |
431 | 441 | ||
432 | 442 | ||
433 | 443 | func getPositionAdjustedOpenNotional (_positionSize,_option,_quoteAssetReserve,_baseAssetReserve) = { | |
434 | 444 | let positionSizeAbs = abs(_positionSize) | |
435 | 445 | let isShort = (0 > _positionSize) | |
436 | 446 | let positionNotional = if ((_option == PNL_OPTION_SPOT)) | |
437 | 447 | then { | |
438 | - | let $ | |
439 | - | let outPositionNotional = $ | |
440 | - | let x1 = $ | |
441 | - | let x2 = $ | |
442 | - | let x3 = $ | |
448 | + | let $t01880418975 = swapOutputWithReserves(!(isShort), positionSizeAbs, false, _quoteAssetReserve, _baseAssetReserve) | |
449 | + | let outPositionNotional = $t01880418975._1 | |
450 | + | let x1 = $t01880418975._2 | |
451 | + | let x2 = $t01880418975._3 | |
452 | + | let x3 = $t01880418975._4 | |
443 | 453 | outPositionNotional | |
444 | 454 | } | |
445 | 455 | else muld(positionSizeAbs, getOracleTwapPrice()) | |
446 | 456 | positionNotional | |
447 | 457 | } | |
448 | 458 | ||
449 | 459 | ||
450 | 460 | func getPositionNotionalAndUnrealizedPnl (_trader,_option) = { | |
451 | - | let $ | |
452 | - | let positionSize = $ | |
453 | - | let positionMargin = $ | |
454 | - | let positionOpenNotional = $ | |
455 | - | let positionLstUpdCPF = $ | |
461 | + | let $t01936919497 = getPosition(_trader) | |
462 | + | let positionSize = $t01936919497._1 | |
463 | + | let positionMargin = $t01936919497._2 | |
464 | + | let positionOpenNotional = $t01936919497._3 | |
465 | + | let positionLstUpdCPF = $t01936919497._4 | |
456 | 466 | if ((positionSize == 0)) | |
457 | 467 | then throw("Invalid position size") | |
458 | 468 | else { | |
459 | 469 | let isShort = (0 > positionSize) | |
460 | 470 | let positionNotional = getPositionAdjustedOpenNotional(positionSize, _option, qtAstR(), bsAstR()) | |
461 | 471 | let unrealizedPnl = if (isShort) | |
462 | 472 | then (positionOpenNotional - positionNotional) | |
463 | 473 | else (positionNotional - positionOpenNotional) | |
464 | 474 | $Tuple2(positionNotional, unrealizedPnl) | |
465 | 475 | } | |
466 | 476 | } | |
467 | 477 | ||
468 | 478 | ||
469 | 479 | func calcMarginRatio (_remainMargin,_badDebt,_positionNotional) = divd((_remainMargin - _badDebt), _positionNotional) | |
470 | 480 | ||
471 | 481 | ||
472 | 482 | func getMarginRatioByOption (_trader,_option) = { | |
473 | - | let $ | |
474 | - | let positionSize = $ | |
475 | - | let positionMargin = $ | |
476 | - | let pon = $ | |
477 | - | let positionLstUpdCPF = $ | |
478 | - | let $ | |
479 | - | let positionNotional = $ | |
480 | - | let unrealizedPnl = $ | |
481 | - | let $ | |
482 | - | let remainMargin = $ | |
483 | - | let badDebt = $ | |
483 | + | let $t02033020441 = getPosition(_trader) | |
484 | + | let positionSize = $t02033020441._1 | |
485 | + | let positionMargin = $t02033020441._2 | |
486 | + | let pon = $t02033020441._3 | |
487 | + | let positionLstUpdCPF = $t02033020441._4 | |
488 | + | let $t02044720540 = getPositionNotionalAndUnrealizedPnl(_trader, _option) | |
489 | + | let positionNotional = $t02044720540._1 | |
490 | + | let unrealizedPnl = $t02044720540._2 | |
491 | + | let $t02054520711 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl) | |
492 | + | let remainMargin = $t02054520711._1 | |
493 | + | let badDebt = $t02054520711._2 | |
484 | 494 | calcMarginRatio(remainMargin, badDebt, positionNotional) | |
485 | 495 | } | |
486 | 496 | ||
487 | 497 | ||
488 | 498 | func getMarginRatio (_trader) = getMarginRatioByOption(_trader, PNL_OPTION_SPOT) | |
489 | 499 | ||
490 | 500 | ||
491 | 501 | func getPartialLiquidationAmount (_trader,_positionSize) = { | |
492 | 502 | let maximumRatio = vmax(partialLiquidationRatio(), (DECIMAL_UNIT - divd(getMarginRatio(_trader), maintenanceMarginRatio()))) | |
493 | 503 | let maxExchangedPositionSize = muld(abs(_positionSize), maximumRatio) | |
494 | 504 | let swapResult = swapOutput((_positionSize > 0), maxExchangedPositionSize, false) | |
495 | 505 | let maxExchangedQuoteAssetAmount = swapResult._1 | |
496 | 506 | let priceImpact = swapResult._8 | |
497 | 507 | if ((maxPriceImpact() > priceImpact)) | |
498 | 508 | then maxExchangedQuoteAssetAmount | |
499 | 509 | else { | |
500 | 510 | let exchangedPositionSize = muld(abs(_positionSize), partialLiquidationRatio()) | |
501 | 511 | let exchangedQuoteAssetAmount = swapOutput((_positionSize > 0), exchangedPositionSize, false)._1 | |
502 | 512 | exchangedQuoteAssetAmount | |
503 | 513 | } | |
504 | 514 | } | |
505 | 515 | ||
506 | 516 | ||
507 | 517 | func internalClosePosition (_trader,_checkMaxPriceImpact) = { | |
508 | - | let $ | |
509 | - | let positionSize = $ | |
510 | - | let positionMargin = $ | |
511 | - | let positionOpenNotional = $ | |
512 | - | let positionLstUpdCPF = $ | |
518 | + | let $t02189322021 = getPosition(_trader) | |
519 | + | let positionSize = $t02189322021._1 | |
520 | + | let positionMargin = $t02189322021._2 | |
521 | + | let positionOpenNotional = $t02189322021._3 | |
522 | + | let positionLstUpdCPF = $t02189322021._4 | |
513 | 523 | let unrealizedPnl = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT)._2 | |
514 | - | let $ | |
515 | - | let remainMargin = $ | |
516 | - | let badDebt = $ | |
524 | + | let $t02211622284 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl) | |
525 | + | let remainMargin = $t02211622284._1 | |
526 | + | let badDebt = $t02211622284._2 | |
517 | 527 | let exchangedPositionSize = -(positionSize) | |
518 | 528 | let realizedPnl = unrealizedPnl | |
519 | 529 | let marginToVault = -(remainMargin) | |
520 | - | let $ | |
521 | - | let exchangedQuoteAssetAmount = $ | |
522 | - | let quoteAssetReserveAfter = $ | |
523 | - | let baseAssetReserveAfter = $ | |
524 | - | let totalPositionSizeAfter = $ | |
525 | - | let cumulativeNotionalAfter = $ | |
526 | - | let totalLongAfter = $ | |
527 | - | let totalShortAfter = $ | |
530 | + | let $t02241122722 = swapOutput((positionSize > 0), abs(positionSize), _checkMaxPriceImpact) | |
531 | + | let exchangedQuoteAssetAmount = $t02241122722._1 | |
532 | + | let quoteAssetReserveAfter = $t02241122722._2 | |
533 | + | let baseAssetReserveAfter = $t02241122722._3 | |
534 | + | let totalPositionSizeAfter = $t02241122722._4 | |
535 | + | let cumulativeNotionalAfter = $t02241122722._5 | |
536 | + | let totalLongAfter = $t02241122722._6 | |
537 | + | let totalShortAfter = $t02241122722._7 | |
528 | 538 | let openInterestNotionalAfter = (openInterestNotional() - positionOpenNotional) | |
529 | 539 | $Tuple12(exchangedPositionSize, badDebt, realizedPnl, marginToVault, quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInterestNotionalAfter, exchangedQuoteAssetAmount, totalLongAfter, totalShortAfter) | |
530 | 540 | } | |
531 | 541 | ||
532 | 542 | ||
533 | 543 | func getTwapSpotPrice () = { | |
534 | 544 | let minuteId = ((lastBlock.timestamp / 1000) / 60) | |
535 | 545 | let startMinuteId = (minuteId - TWAP_INTERVAL) | |
536 | 546 | let listStr = valueOrElse(getString(this, k_lastDataStr), "") | |
537 | 547 | let list = split(listStr, ",") | |
538 | 548 | func filterFn (accumulator,next) = if ((startMinuteId >= parseIntValue(next))) | |
539 | 549 | then (accumulator :+ parseIntValue(next)) | |
540 | 550 | else accumulator | |
541 | 551 | ||
542 | 552 | let listF = { | |
543 | 553 | let $l = list | |
544 | 554 | let $s = size($l) | |
545 | 555 | let $acc0 = nil | |
546 | 556 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
547 | 557 | then $a | |
548 | 558 | else filterFn($a, $l[$i]) | |
549 | 559 | ||
550 | 560 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
551 | 561 | then $a | |
552 | 562 | else throw("List size exceeds 20") | |
553 | 563 | ||
554 | 564 | $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) | |
555 | 565 | } | |
556 | 566 | let maxIndex = if ((size(listF) > 0)) | |
557 | 567 | then max(listF) | |
558 | 568 | else parseIntValue(list[0]) | |
559 | 569 | let lastMinuteId = valueOrElse(getInteger(this, k_lastMinuteId), 0) | |
560 | 570 | let endLastCumulativePrice = valueOrElse(getInteger(this, ((k_twapDataLastCumulativePrice + "_") + toString(lastMinuteId))), 0) | |
561 | 571 | let endLastPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(lastMinuteId))), 0) | |
562 | 572 | let nowCumulativePrice = (endLastCumulativePrice + ((minuteId - lastMinuteId) * endLastPrice)) | |
563 | 573 | let startLastCumulativePrice = valueOrElse(getInteger(this, ((k_twapDataLastCumulativePrice + "_") + toString(maxIndex))), 0) | |
564 | 574 | let startLastPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(maxIndex))), 0) | |
565 | 575 | let startCumulativePrice = (startLastCumulativePrice + ((startMinuteId - maxIndex) * startLastPrice)) | |
566 | 576 | ((nowCumulativePrice - startCumulativePrice) / TWAP_INTERVAL) | |
567 | 577 | } | |
568 | 578 | ||
569 | 579 | ||
570 | 580 | func updateSettings (_initMarginRatio,_mmr,_liquidationFeeRatio,_fundingPeriod,_fee,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread) = [IntegerEntry(k_initMarginRatio, _initMarginRatio), IntegerEntry(k_maintenanceMarginRatio, _mmr), IntegerEntry(k_liquidationFeeRatio, _liquidationFeeRatio), IntegerEntry(k_fundingPeriod, _fundingPeriod), IntegerEntry(k_fee, _fee), IntegerEntry(k_spreadLimit, _spreadLimit), IntegerEntry(k_maxPriceImpact, _maxPriceImpact), IntegerEntry(k_partialLiquidationRatio, _partialLiquidationRatio), IntegerEntry(k_maxPriceSpread, _maxPriceSpread)] | |
571 | 581 | ||
572 | 582 | ||
573 | 583 | 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)] | |
574 | 584 | ||
575 | 585 | ||
576 | 586 | 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)] | |
577 | 587 | ||
578 | 588 | ||
579 | 589 | func appendTwap (price) = { | |
580 | 590 | let minuteId = ((lastBlock.timestamp / 1000) / 60) | |
581 | 591 | let previousMinuteId = valueOrElse(getInteger(this, k_lastMinuteId), 0) | |
582 | 592 | if ((previousMinuteId > minuteId)) | |
583 | 593 | then throw("TWAP out-of-order") | |
584 | 594 | else { | |
585 | 595 | let lastMinuteId = if ((previousMinuteId == 0)) | |
586 | 596 | then minuteId | |
587 | 597 | else previousMinuteId | |
588 | 598 | if ((minuteId > previousMinuteId)) | |
589 | 599 | then { | |
590 | 600 | let prevCumulativePrice = valueOrElse(getInteger(this, ((k_twapDataLastCumulativePrice + "_") + toString(previousMinuteId))), 0) | |
591 | 601 | let prevPrice = valueOrElse(getInteger(this, ((k_twapDataLastPrice + "_") + toString(previousMinuteId))), price) | |
592 | 602 | let lastCumulativePrice = (prevCumulativePrice + ((minuteId - lastMinuteId) * prevPrice)) | |
593 | 603 | let list = pushToQueue(strToList(valueOrElse(getString(this, k_lastDataStr), "")), TWAP_INTERVAL, toString(minuteId)) | |
594 | 604 | [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))] | |
595 | 605 | } | |
596 | 606 | else { | |
597 | 607 | let twapDataPreviousMinuteId = valueOrElse(getInteger(this, toCompositeKey(k_twapDataPreviousMinuteId, toString(minuteId))), 0) | |
598 | 608 | let prevCumulativePrice = valueOrElse(getInteger(this, toCompositeKey(k_twapDataLastCumulativePrice, toString(twapDataPreviousMinuteId))), 0) | |
599 | 609 | let prevPrice = valueOrElse(getInteger(this, toCompositeKey(k_twapDataLastPrice, toString(twapDataPreviousMinuteId))), price) | |
600 | 610 | let lastCumulativePrice = (prevCumulativePrice + ((minuteId - twapDataPreviousMinuteId) * prevPrice)) | |
601 | 611 | [IntegerEntry(toCompositeKey(k_twapDataLastCumulativePrice, toString(minuteId)), lastCumulativePrice), IntegerEntry(toCompositeKey(k_twapDataLastPrice, toString(minuteId)), price)] | |
602 | 612 | } | |
603 | 613 | } | |
604 | 614 | } | |
605 | 615 | ||
606 | 616 | ||
607 | 617 | func updateAmmReserves (_qtAstR,_bsAstR) = [IntegerEntry(k_quoteAssetReserve, _qtAstR), IntegerEntry(k_baseAssetReserve, _bsAstR)] | |
608 | 618 | ||
609 | 619 | ||
610 | 620 | func updateAmm (_qtAstR,_bsAstR,_totalPositionSizeAfter,_cumulativeNotionalAfter,_openInterestNotional,_totalLongPositionSize,_totalShortPositionSize) = if (((_totalLongPositionSize - _totalShortPositionSize) != _totalPositionSizeAfter)) | |
611 | 621 | then throw(((((("Invalid AMM state data: " + toString(_totalLongPositionSize)) + " + ") + toString(_totalShortPositionSize)) + " != ") + toString(_totalPositionSizeAfter))) | |
612 | 622 | else ((updateAmmReserves(_qtAstR, _bsAstR) ++ [IntegerEntry(k_totalPositionSize, _totalPositionSizeAfter), IntegerEntry(k_cumulativeNotional, _cumulativeNotionalAfter), IntegerEntry(k_openInterestNotional, _openInterestNotional), IntegerEntry(k_totalLongPositionSize, _totalLongPositionSize), IntegerEntry(k_totalShortPositionSize, _totalShortPositionSize)]) ++ appendTwap(divd(_qtAstR, _bsAstR))) | |
613 | 623 | ||
614 | 624 | ||
615 | - | func deletePosition (_address) = [DeleteEntry(toCompositeKey(k_positionSize, _address)), DeleteEntry(toCompositeKey(k_positionMargin, _address)), DeleteEntry(toCompositeKey(k_positionOpenNotional, _address)), DeleteEntry(toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _address))] | |
625 | + | func deletePosition (_address) = [DeleteEntry(toCompositeKey(k_positionSize, _address)), DeleteEntry(toCompositeKey(k_positionMargin, _address)), DeleteEntry(toCompositeKey(k_positionOpenNotional, _address)), DeleteEntry(toCompositeKey(k_positionLastUpdatedCumulativePremiumFraction, _address)), IntegerEntry(toCompositeKey(k_positionClosedDate, _address), lastBlock.timestamp)] | |
616 | 626 | ||
617 | 627 | ||
618 | 628 | func withdraw (_address,_amount) = { | |
619 | 629 | let balance = assetBalance(this, quoteAsset()) | |
620 | 630 | if ((_amount > balance)) | |
621 | 631 | then throw(((("Unable to withdraw " + toString(_amount)) + " from contract balance ") + toString(balance))) | |
622 | 632 | else [ScriptTransfer(_address, _amount, quoteAsset())] | |
623 | 633 | } | |
624 | 634 | ||
625 | 635 | ||
626 | 636 | func updateBalance (i) = if ((0 > i)) | |
627 | 637 | then throw("Balance") | |
628 | 638 | else [IntegerEntry(k_balance, i)] | |
629 | 639 | ||
630 | 640 | ||
631 | 641 | func transferFee (i) = [ScriptTransfer(stakingAddress(), i, quoteAsset())] | |
632 | 642 | ||
633 | 643 | ||
634 | 644 | @Callable(i) | |
635 | 645 | func pause () = if ((i.caller != adminAddress())) | |
636 | 646 | then throw("Invalid togglePause params") | |
637 | 647 | else [BooleanEntry(k_paused, true)] | |
638 | 648 | ||
639 | 649 | ||
640 | 650 | ||
641 | 651 | @Callable(i) | |
642 | 652 | func unpause () = if ((i.caller != adminAddress())) | |
643 | 653 | then throw("Invalid togglePause params") | |
644 | 654 | else [BooleanEntry(k_paused, false)] | |
645 | 655 | ||
646 | 656 | ||
647 | 657 | ||
648 | 658 | @Callable(i) | |
649 | 659 | func addLiquidity (_quoteAssetAmount) = if (if ((i.caller != adminAddress())) | |
650 | 660 | then true | |
651 | 661 | else (0 >= _quoteAssetAmount)) | |
652 | 662 | then throw("Invalid addLiquidity params") | |
653 | 663 | else { | |
654 | 664 | let _qtAstR = qtAstR() | |
655 | 665 | let _bsAstR = bsAstR() | |
656 | 666 | let price = divd(_qtAstR, _bsAstR) | |
657 | 667 | let baseAssetAmountToAdd = divd(_quoteAssetAmount, price) | |
658 | 668 | let qtAstRAfter = (_qtAstR + _quoteAssetAmount) | |
659 | 669 | let bsAstRAfter = (_bsAstR + baseAssetAmountToAdd) | |
660 | 670 | updateAmmReserves(qtAstRAfter, bsAstRAfter) | |
661 | 671 | } | |
662 | 672 | ||
663 | 673 | ||
664 | 674 | ||
665 | 675 | @Callable(i) | |
666 | 676 | func removeLiquidity (_quoteAssetAmount) = if (if ((i.caller != adminAddress())) | |
667 | 677 | then true | |
668 | 678 | else (0 >= _quoteAssetAmount)) | |
669 | 679 | then throw("Invalid removeLiquidity params") | |
670 | 680 | else { | |
671 | 681 | let _qtAstR = qtAstR() | |
672 | 682 | let _bsAstR = bsAstR() | |
673 | 683 | let price = divd(_qtAstR, _bsAstR) | |
674 | 684 | let baseAssetAmountToRemove = divd(_quoteAssetAmount, price) | |
675 | 685 | let qtAstRAfter = (_qtAstR - _quoteAssetAmount) | |
676 | 686 | let bsAstRAfter = (_bsAstR - baseAssetAmountToRemove) | |
677 | 687 | updateAmmReserves(qtAstRAfter, bsAstRAfter) | |
678 | 688 | } | |
679 | 689 | ||
680 | 690 | ||
681 | 691 | ||
682 | 692 | @Callable(i) | |
683 | 693 | func changeSettings (_initMarginRatio,_mmr,_liquidationFeeRatio,_fundingPeriod,_fee,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread) = if ((i.caller != adminAddress())) | |
684 | 694 | then throw("Invalid changeSettings params") | |
685 | 695 | else updateSettings(_initMarginRatio, _mmr, _liquidationFeeRatio, _fundingPeriod, _fee, _spreadLimit, _maxPriceImpact, _partialLiquidationRatio, _maxPriceSpread) | |
686 | 696 | ||
687 | 697 | ||
688 | 698 | ||
689 | 699 | @Callable(i) | |
690 | 700 | func initialize (_qtAstR,_bsAstR,_fundingPeriod,_initMarginRatio,_mmr,_liquidationFeeRatio,_fee,_oracle,_oracleKey,_coordinator,_spreadLimit,_maxPriceImpact,_partialLiquidationRatio,_maxPriceSpread) = if (if (if (if (if (if (if (if (if (if (if (if ((0 >= _qtAstR)) | |
691 | 701 | then true | |
692 | 702 | else (0 >= _bsAstR)) | |
693 | 703 | then true | |
694 | 704 | else (0 >= _fundingPeriod)) | |
695 | 705 | then true | |
696 | 706 | else (0 >= _initMarginRatio)) | |
697 | 707 | then true | |
698 | 708 | else (0 >= _mmr)) | |
699 | 709 | then true | |
700 | 710 | else (0 >= _liquidationFeeRatio)) | |
701 | 711 | then true | |
702 | 712 | else (0 >= _fee)) | |
703 | 713 | then true | |
704 | 714 | else (0 >= _spreadLimit)) | |
705 | 715 | then true | |
706 | 716 | else (0 >= _maxPriceImpact)) | |
707 | 717 | then true | |
708 | 718 | else (0 >= _partialLiquidationRatio)) | |
709 | 719 | then true | |
710 | 720 | else (0 >= _maxPriceSpread)) | |
711 | 721 | then true | |
712 | 722 | else initialized()) | |
713 | 723 | then throw("Invalid initialize parameters") | |
714 | 724 | else ((((updateAmm(_qtAstR, _bsAstR, 0, 0, 0, 0, 0) ++ updateSettings(_initMarginRatio, _mmr, _liquidationFeeRatio, _fundingPeriod, _fee, _spreadLimit, _maxPriceImpact, _partialLiquidationRatio, _maxPriceSpread)) ++ updateFunding((lastBlock.timestamp + _fundingPeriod), 0, 0, 0, 0)) ++ updateBalance(0)) ++ [BooleanEntry(k_initialized, true), StringEntry(k_ora, _oracle), StringEntry(k_ora_key, _oracleKey), StringEntry(k_coordinatorAddress, _coordinator)]) | |
715 | 725 | ||
716 | 726 | ||
717 | 727 | ||
718 | 728 | @Callable(i) | |
719 | 729 | func setInitMarginRatio (_initMarginRatio) = if (if ((0 >= _initMarginRatio)) | |
720 | 730 | then true | |
721 | 731 | else !(initialized())) | |
722 | 732 | then throw("Invalid setInitMarginRatio parameters") | |
723 | 733 | else updateSettings(_initMarginRatio, maintenanceMarginRatio(), liquidationFeeRatio(), fundingPeriodRaw(), fee(), spreadLimit(), maxPriceImpact(), partialLiquidationRatio(), maxPriceSpread()) | |
724 | 734 | ||
725 | 735 | ||
726 | 736 | ||
727 | 737 | @Callable(i) | |
728 | 738 | func decreasePosition (_amount,_leverage,_minBaseAssetAmount) = if (if (if (if (if ((0 >= _amount)) | |
729 | 739 | then true | |
730 | 740 | else !(initialized())) | |
731 | 741 | then true | |
732 | 742 | else !(requireMoreMarginRatio(divd(DECIMAL_UNIT, _leverage), initMarginRatio(), true))) | |
733 | 743 | then true | |
734 | 744 | else !(requireOpenPosition(toString(i.caller)))) | |
735 | 745 | then true | |
736 | 746 | else paused()) | |
737 | 747 | then throw("Invalid decreasePosition parameters") | |
738 | 748 | else { | |
739 | - | let $ | |
740 | - | let oldPositionSize = $ | |
741 | - | let oldPositionMargin = $ | |
742 | - | let oldPositionOpenNotional = $ | |
743 | - | let oldPositionLstUpdCPF = $ | |
749 | + | let $t03470134853 = getPosition(toString(i.caller)) | |
750 | + | let oldPositionSize = $t03470134853._1 | |
751 | + | let oldPositionMargin = $t03470134853._2 | |
752 | + | let oldPositionOpenNotional = $t03470134853._3 | |
753 | + | let oldPositionLstUpdCPF = $t03470134853._4 | |
744 | 754 | let _direction = if ((oldPositionSize > 0)) | |
745 | 755 | then DIR_SHORT | |
746 | 756 | else DIR_LONG | |
747 | 757 | let isAdd = (_direction == DIR_LONG) | |
748 | 758 | let openNotional = muld(_amount, _leverage) | |
749 | - | let $ | |
750 | - | let oldPositionNotional = $ | |
751 | - | let unrealizedPnl = $ | |
752 | - | let $ | |
759 | + | let $t03502635142 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT) | |
760 | + | let oldPositionNotional = $t03502635142._1 | |
761 | + | let unrealizedPnl = $t03502635142._2 | |
762 | + | let $t03514837697 = if ((oldPositionNotional > openNotional)) | |
753 | 763 | then { | |
754 | - | let $ | |
755 | - | let exchangedPositionSize = $ | |
756 | - | let quoteAssetReserveAfter = $ | |
757 | - | let baseAssetReserveAfter = $ | |
758 | - | let totalPositionSizeAfter = $ | |
759 | - | let cumulativeNotionalAfter = $ | |
764 | + | let $t03552535744 = swapInput(isAdd, openNotional) | |
765 | + | let exchangedPositionSize = $t03552535744._1 | |
766 | + | let quoteAssetReserveAfter = $t03552535744._2 | |
767 | + | let baseAssetReserveAfter = $t03552535744._3 | |
768 | + | let totalPositionSizeAfter = $t03552535744._4 | |
769 | + | let cumulativeNotionalAfter = $t03552535744._5 | |
760 | 770 | let exchangedPositionSizeAbs = abs(exchangedPositionSize) | |
761 | 771 | if (if ((_minBaseAssetAmount != 0)) | |
762 | 772 | then (_minBaseAssetAmount > exchangedPositionSizeAbs) | |
763 | 773 | else false) | |
764 | 774 | then throw(((("Too little base asset exchanged, got " + toString(exchangedPositionSizeAbs)) + " expected ") + toString(_minBaseAssetAmount))) | |
765 | 775 | else { | |
766 | 776 | let realizedPnl = divd(muld(unrealizedPnl, exchangedPositionSizeAbs), abs(oldPositionSize)) | |
767 | - | let $ | |
768 | - | let remainMargin = $ | |
769 | - | let badDebt = $ | |
770 | - | let fundingPayment = $ | |
777 | + | let $t03618136426 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl) | |
778 | + | let remainMargin = $t03618136426._1 | |
779 | + | let badDebt = $t03618136426._2 | |
780 | + | let fundingPayment = $t03618136426._3 | |
771 | 781 | let exchangedQuoteAssetAmount = openNotional | |
772 | 782 | let unrealizedPnlAfter = (unrealizedPnl - realizedPnl) | |
773 | 783 | let remainOpenNotional = if ((oldPositionSize > 0)) | |
774 | 784 | then ((oldPositionNotional - exchangedQuoteAssetAmount) - unrealizedPnlAfter) | |
775 | 785 | else ((unrealizedPnlAfter + oldPositionNotional) - exchangedQuoteAssetAmount) | |
776 | 786 | let newPositionSize = (oldPositionSize + exchangedPositionSize) | |
777 | 787 | $Tuple11(newPositionSize, remainMargin, abs(remainOpenNotional), latestCumulativePremiumFraction(newPositionSize), baseAssetReserveAfter, quoteAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, (openInterestNotional() - openNotional), (totalLongPositionSize() - (if ((newPositionSize > 0)) | |
778 | 788 | then abs(exchangedPositionSize) | |
779 | 789 | else 0)), (totalShortPositionSize() - (if ((0 > newPositionSize)) | |
780 | 790 | then abs(exchangedPositionSize) | |
781 | 791 | else 0))) | |
782 | 792 | } | |
783 | 793 | } | |
784 | 794 | else throw("Close position first") | |
785 | - | let newPositionSize = $ | |
786 | - | let newPositionRemainMargin = $ | |
787 | - | let newPositionOpenNotional = $ | |
788 | - | let newPositionLatestCPF = $ | |
789 | - | let baseAssetReserveAfter = $ | |
790 | - | let quoteAssetReserveAfter = $ | |
791 | - | let totalPositionSizeAfter = $ | |
792 | - | let cumulativeNotionalAfter = $ | |
793 | - | let openInterestNotionalAfter = $ | |
794 | - | let totalLongAfter = $ | |
795 | - | let totalShortAfter = $ | |
795 | + | let newPositionSize = $t03514837697._1 | |
796 | + | let newPositionRemainMargin = $t03514837697._2 | |
797 | + | let newPositionOpenNotional = $t03514837697._3 | |
798 | + | let newPositionLatestCPF = $t03514837697._4 | |
799 | + | let baseAssetReserveAfter = $t03514837697._5 | |
800 | + | let quoteAssetReserveAfter = $t03514837697._6 | |
801 | + | let totalPositionSizeAfter = $t03514837697._7 | |
802 | + | let cumulativeNotionalAfter = $t03514837697._8 | |
803 | + | let openInterestNotionalAfter = $t03514837697._9 | |
804 | + | let totalLongAfter = $t03514837697._10 | |
805 | + | let totalShortAfter = $t03514837697._11 | |
796 | 806 | let notifyNotional = invoke(minerAddress(), "notifyNotional", [toString(i.caller), newPositionOpenNotional], nil) | |
797 | 807 | if ((notifyNotional == notifyNotional)) | |
798 | 808 | then (updatePosition(toString(i.caller), newPositionSize, newPositionRemainMargin, newPositionOpenNotional, newPositionLatestCPF) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter)) | |
799 | 809 | else throw("Strict value is not equal to itself.") | |
800 | 810 | } | |
801 | 811 | ||
802 | 812 | ||
803 | 813 | ||
804 | 814 | @Callable(i) | |
805 | 815 | func increasePosition (_direction,_leverage,_minBaseAssetAmount) = { | |
806 | 816 | let _rawAmount = i.payments[0].amount | |
807 | 817 | if (if (if (if (if (if (if ((_direction != DIR_LONG)) | |
808 | 818 | then (_direction != DIR_SHORT) | |
809 | 819 | else false) | |
810 | 820 | then true | |
811 | 821 | else (0 >= _rawAmount)) | |
812 | 822 | then true | |
813 | 823 | else !(initialized())) | |
814 | 824 | then true | |
815 | 825 | else (i.payments[0].assetId != quoteAsset())) | |
816 | 826 | then true | |
817 | 827 | else !(requireMoreMarginRatio(divd(DECIMAL_UNIT, _leverage), initMarginRatio(), true))) | |
818 | 828 | then true | |
819 | 829 | else paused()) | |
820 | 830 | then throw("Invalid increasePosition parameters") | |
821 | 831 | else { | |
822 | 832 | let feeAmount = muld(_rawAmount, fee()) | |
823 | 833 | let _amount = (_rawAmount - feeAmount) | |
824 | - | let $ | |
825 | - | let oldPositionSize = $ | |
826 | - | let oldPositionMargin = $ | |
827 | - | let oldPositionOpenNotional = $ | |
828 | - | let oldPositionLstUpdCPF = $ | |
834 | + | let $t03881538967 = getPosition(toString(i.caller)) | |
835 | + | let oldPositionSize = $t03881538967._1 | |
836 | + | let oldPositionMargin = $t03881538967._2 | |
837 | + | let oldPositionOpenNotional = $t03881538967._3 | |
838 | + | let oldPositionLstUpdCPF = $t03881538967._4 | |
829 | 839 | let isNewPosition = (oldPositionSize == 0) | |
830 | 840 | let isSameDirection = if ((oldPositionSize > 0)) | |
831 | 841 | then (_direction == DIR_LONG) | |
832 | 842 | else (_direction == DIR_SHORT) | |
833 | 843 | let expandExisting = if (!(isNewPosition)) | |
834 | 844 | then isSameDirection | |
835 | 845 | else false | |
836 | 846 | let isAdd = (_direction == DIR_LONG) | |
837 | - | let $ | |
847 | + | let $t03925641824 = if (if (isNewPosition) | |
838 | 848 | then true | |
839 | 849 | else expandExisting) | |
840 | 850 | then { | |
841 | 851 | let openNotional = muld(_amount, _leverage) | |
842 | - | let $ | |
843 | - | let amountBaseAssetBought = $ | |
844 | - | let quoteAssetReserveAfter = $ | |
845 | - | let baseAssetReserveAfter = $ | |
846 | - | let totalPositionSizeAfter = $ | |
847 | - | let cumulativeNotionalAfter = $ | |
852 | + | let $t03968039886 = swapInput(isAdd, openNotional) | |
853 | + | let amountBaseAssetBought = $t03968039886._1 | |
854 | + | let quoteAssetReserveAfter = $t03968039886._2 | |
855 | + | let baseAssetReserveAfter = $t03968039886._3 | |
856 | + | let totalPositionSizeAfter = $t03968039886._4 | |
857 | + | let cumulativeNotionalAfter = $t03968039886._5 | |
848 | 858 | if (if ((_minBaseAssetAmount != 0)) | |
849 | 859 | then (_minBaseAssetAmount > abs(amountBaseAssetBought)) | |
850 | 860 | else false) | |
851 | 861 | then throw(((("Limit error: " + toString(abs(amountBaseAssetBought))) + " < ") + toString(_minBaseAssetAmount))) | |
852 | 862 | else { | |
853 | 863 | let newPositionSize = (oldPositionSize + amountBaseAssetBought) | |
854 | 864 | let increaseMarginRequirement = divd(openNotional, _leverage) | |
855 | - | let $ | |
856 | - | let remainMargin = $ | |
857 | - | let x1 = $ | |
858 | - | let x2 = $ | |
865 | + | let $t04026740506 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, increaseMarginRequirement) | |
866 | + | let remainMargin = $t04026740506._1 | |
867 | + | let x1 = $t04026740506._2 | |
868 | + | let x2 = $t04026740506._3 | |
859 | 869 | if (!(requireNotOverSpreadLimit(quoteAssetReserveAfter, baseAssetReserveAfter))) | |
860 | 870 | then throw("Over max spread limit") | |
861 | 871 | else $Tuple11(newPositionSize, remainMargin, (oldPositionOpenNotional + openNotional), latestCumulativePremiumFraction(newPositionSize), baseAssetReserveAfter, quoteAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, (openInterestNotional() + openNotional), (totalLongPositionSize() + (if ((newPositionSize > 0)) | |
862 | 872 | then abs(amountBaseAssetBought) | |
863 | 873 | else 0)), (totalShortPositionSize() + (if ((0 > newPositionSize)) | |
864 | 874 | then abs(amountBaseAssetBought) | |
865 | 875 | else 0))) | |
866 | 876 | } | |
867 | 877 | } | |
868 | 878 | else { | |
869 | 879 | let openNotional = muld(_amount, _leverage) | |
870 | - | let $ | |
871 | - | let oldPositionNotional = $ | |
872 | - | let unrealizedPnl = $ | |
880 | + | let $t04151741633 = getPositionNotionalAndUnrealizedPnl(toString(i.caller), PNL_OPTION_SPOT) | |
881 | + | let oldPositionNotional = $t04151741633._1 | |
882 | + | let unrealizedPnl = $t04151741633._2 | |
873 | 883 | if ((oldPositionNotional > openNotional)) | |
874 | 884 | then throw("Use decreasePosition to decrease position size") | |
875 | 885 | else throw("Close position first") | |
876 | 886 | } | |
877 | - | let newPositionSize = $ | |
878 | - | let newPositionRemainMargin = $ | |
879 | - | let newPositionOpenNotional = $ | |
880 | - | let newPositionLatestCPF = $ | |
881 | - | let baseAssetReserveAfter = $ | |
882 | - | let quoteAssetReserveAfter = $ | |
883 | - | let totalPositionSizeAfter = $ | |
884 | - | let cumulativeNotionalAfter = $ | |
885 | - | let openInterestNotionalAfter = $ | |
886 | - | let totalLongAfter = $ | |
887 | - | let totalShortAfter = $ | |
887 | + | let newPositionSize = $t03925641824._1 | |
888 | + | let newPositionRemainMargin = $t03925641824._2 | |
889 | + | let newPositionOpenNotional = $t03925641824._3 | |
890 | + | let newPositionLatestCPF = $t03925641824._4 | |
891 | + | let baseAssetReserveAfter = $t03925641824._5 | |
892 | + | let quoteAssetReserveAfter = $t03925641824._6 | |
893 | + | let totalPositionSizeAfter = $t03925641824._7 | |
894 | + | let cumulativeNotionalAfter = $t03925641824._8 | |
895 | + | let openInterestNotionalAfter = $t03925641824._9 | |
896 | + | let totalLongAfter = $t03925641824._10 | |
897 | + | let totalShortAfter = $t03925641824._11 | |
888 | 898 | let feeToStakers = (feeAmount / 2) | |
889 | 899 | let feeToInsurance = (feeAmount - feeToStakers) | |
890 | 900 | let stake = invoke(quoteAssetStaking(), "lockNeutrinoSP", [toString(stakingAddress()), ALL_FEES], [AttachedPayment(quoteAsset(), _amount)]) | |
891 | 901 | if ((stake == stake)) | |
892 | 902 | then { | |
893 | 903 | let depositInsurance = invoke(insuranceAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), feeToInsurance)]) | |
894 | 904 | if ((depositInsurance == depositInsurance)) | |
895 | 905 | then { | |
896 | 906 | let notifyFee = invoke(minerAddress(), "notifyFees", [toString(i.caller), feeAmount], nil) | |
897 | 907 | if ((notifyFee == notifyFee)) | |
898 | 908 | then { | |
899 | 909 | let notifyNotional = invoke(minerAddress(), "notifyNotional", [toString(i.caller), newPositionOpenNotional], nil) | |
900 | 910 | if ((notifyNotional == notifyNotional)) | |
901 | 911 | then (((updatePosition(toString(i.caller), newPositionSize, newPositionRemainMargin, newPositionOpenNotional, newPositionLatestCPF) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter)) ++ transferFee(feeToStakers)) ++ updateBalance((cbalance() + _amount))) | |
902 | 912 | else throw("Strict value is not equal to itself.") | |
903 | 913 | } | |
904 | 914 | else throw("Strict value is not equal to itself.") | |
905 | 915 | } | |
906 | 916 | else throw("Strict value is not equal to itself.") | |
907 | 917 | } | |
908 | 918 | else throw("Strict value is not equal to itself.") | |
909 | 919 | } | |
910 | 920 | } | |
911 | 921 | ||
912 | 922 | ||
913 | 923 | ||
914 | 924 | @Callable(i) | |
915 | 925 | func addMargin () = { | |
916 | 926 | let _rawAmount = i.payments[0].amount | |
917 | 927 | if (if (if (if ((i.payments[0].assetId != quoteAsset())) | |
918 | 928 | then true | |
919 | 929 | else !(requireOpenPosition(toString(i.caller)))) | |
920 | 930 | then true | |
921 | 931 | else !(initialized())) | |
922 | 932 | then true | |
923 | 933 | else paused()) | |
924 | 934 | then throw("Invalid addMargin parameters") | |
925 | 935 | else { | |
926 | 936 | let feeAmount = muld(_rawAmount, fee()) | |
927 | 937 | let _amount = (_rawAmount - feeAmount) | |
928 | - | let $ | |
929 | - | let oldPositionSize = $ | |
930 | - | let oldPositionMargin = $ | |
931 | - | let oldPositionOpenNotional = $ | |
932 | - | let oldPositionLstUpdCPF = $ | |
938 | + | let $t04338043532 = getPosition(toString(i.caller)) | |
939 | + | let oldPositionSize = $t04338043532._1 | |
940 | + | let oldPositionMargin = $t04338043532._2 | |
941 | + | let oldPositionOpenNotional = $t04338043532._3 | |
942 | + | let oldPositionLstUpdCPF = $t04338043532._4 | |
933 | 943 | let feeToStakers = (feeAmount / 2) | |
934 | 944 | let feeToInsurance = (feeAmount - feeToStakers) | |
935 | 945 | let stake = invoke(quoteAssetStaking(), "lockNeutrinoSP", [toString(stakingAddress()), ALL_FEES], [AttachedPayment(quoteAsset(), _amount)]) | |
936 | 946 | if ((stake == stake)) | |
937 | 947 | then { | |
938 | 948 | let depositInsurance = invoke(insuranceAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), feeToInsurance)]) | |
939 | 949 | if ((depositInsurance == depositInsurance)) | |
940 | 950 | then { | |
941 | 951 | let notifyFee = invoke(minerAddress(), "notifyFees", [toString(i.caller), feeAmount], nil) | |
942 | 952 | if ((notifyFee == notifyFee)) | |
943 | 953 | then ((updatePosition(toString(i.caller), oldPositionSize, (oldPositionMargin + _amount), oldPositionOpenNotional, oldPositionLstUpdCPF) ++ transferFee(feeToStakers)) ++ updateBalance((cbalance() + _amount))) | |
944 | 954 | else throw("Strict value is not equal to itself.") | |
945 | 955 | } | |
946 | 956 | else throw("Strict value is not equal to itself.") | |
947 | 957 | } | |
948 | 958 | else throw("Strict value is not equal to itself.") | |
949 | 959 | } | |
950 | 960 | } | |
951 | 961 | ||
952 | 962 | ||
953 | 963 | ||
954 | 964 | @Callable(i) | |
955 | 965 | func removeMargin (_amount) = if (if (if (if ((0 >= _amount)) | |
956 | 966 | then true | |
957 | 967 | else !(requireOpenPosition(toString(i.caller)))) | |
958 | 968 | then true | |
959 | 969 | else !(initialized())) | |
960 | 970 | then true | |
961 | 971 | else paused()) | |
962 | 972 | then throw("Invalid removeMargin parameters") | |
963 | 973 | else { | |
964 | - | let $ | |
965 | - | let oldPositionSize = $ | |
966 | - | let oldPositionMargin = $ | |
967 | - | let oldPositionOpenNotional = $ | |
968 | - | let oldPositionLstUpdCPF = $ | |
974 | + | let $t04458144733 = getPosition(toString(i.caller)) | |
975 | + | let oldPositionSize = $t04458144733._1 | |
976 | + | let oldPositionMargin = $t04458144733._2 | |
977 | + | let oldPositionOpenNotional = $t04458144733._3 | |
978 | + | let oldPositionLstUpdCPF = $t04458144733._4 | |
969 | 979 | let marginDelta = -(_amount) | |
970 | - | let $ | |
971 | - | let remainMargin = $ | |
972 | - | let badDebt = $ | |
980 | + | let $t04477044949 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, marginDelta) | |
981 | + | let remainMargin = $t04477044949._1 | |
982 | + | let badDebt = $t04477044949._2 | |
973 | 983 | if ((badDebt != 0)) | |
974 | 984 | then throw("Invalid removed margin amount") | |
975 | 985 | else { | |
976 | 986 | let marginRatio = calcMarginRatio(remainMargin, badDebt, oldPositionOpenNotional) | |
977 | 987 | if (!(requireMoreMarginRatio(marginRatio, initMarginRatio(), true))) | |
978 | 988 | then throw(((("Too much margin removed: " + toString(marginRatio)) + " < ") + toString(initMarginRatio()))) | |
979 | 989 | else { | |
980 | 990 | let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [_amount, toBase58String(quoteAsset())], nil) | |
981 | 991 | if ((unstake == unstake)) | |
982 | 992 | then ((updatePosition(toString(i.caller), oldPositionSize, remainMargin, oldPositionOpenNotional, latestCumulativePremiumFraction(oldPositionSize)) ++ withdraw(i.caller, _amount)) ++ updateBalance((cbalance() - _amount))) | |
983 | 993 | else throw("Strict value is not equal to itself.") | |
984 | 994 | } | |
985 | 995 | } | |
986 | 996 | } | |
987 | 997 | ||
988 | 998 | ||
989 | 999 | ||
990 | 1000 | @Callable(i) | |
991 | - | func closePosition () = if (if (if (!(requireOpenPosition(toString(i.caller)))) | |
992 | - | then true | |
993 | - | else !(initialized())) | |
994 | - | then true | |
995 | - | else paused()) | |
996 | - | then throw("Invalid closePosition parameters") | |
997 | - | else { | |
998 | - | let $t04553145921 = internalClosePosition(toString(i.caller), true) | |
999 | - | let x1 = $t04553145921._1 | |
1000 | - | let positionBadDebt = $t04553145921._2 | |
1001 | - | let realizedPnl = $t04553145921._3 | |
1002 | - | let marginToVault = $t04553145921._4 | |
1003 | - | let quoteAssetReserveAfter = $t04553145921._5 | |
1004 | - | let baseAssetReserveAfter = $t04553145921._6 | |
1005 | - | let totalPositionSizeAfter = $t04553145921._7 | |
1006 | - | let cumulativeNotionalAfter = $t04553145921._8 | |
1007 | - | let openInterestNotionalAfter = $t04553145921._9 | |
1008 | - | let x2 = $t04553145921._10 | |
1009 | - | let totalLongAfter = $t04553145921._11 | |
1010 | - | let totalShortAfter = $t04553145921._12 | |
1011 | - | if ((positionBadDebt > 0)) | |
1012 | - | then throw("Unable to close position with bad debt") | |
1013 | - | else { | |
1014 | - | let withdrawAmount = abs(marginToVault) | |
1015 | - | let ammBalance = (cbalance() - withdrawAmount) | |
1016 | - | let $t04613046272 = if ((0 > ammBalance)) | |
1017 | - | then $Tuple2(0, abs(ammBalance)) | |
1018 | - | else $Tuple2(ammBalance, 0) | |
1019 | - | let ammNewBalance = $t04613046272._1 | |
1020 | - | let getFromInsurance = $t04613046272._2 | |
1021 | - | let x = if ((getFromInsurance > 0)) | |
1022 | - | then { | |
1023 | - | let withdrawInsurance = invoke(insuranceAddress(), "withdraw", [getFromInsurance], nil) | |
1024 | - | if ((withdrawInsurance == withdrawInsurance)) | |
1025 | - | then nil | |
1026 | - | else throw("Strict value is not equal to itself.") | |
1027 | - | } | |
1028 | - | else nil | |
1029 | - | if ((x == x)) | |
1030 | - | then { | |
1031 | - | let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [(withdrawAmount - getFromInsurance), toBase58String(quoteAsset())], nil) | |
1032 | - | if ((unstake == unstake)) | |
1033 | - | then { | |
1034 | - | let notifyNotional = invoke(minerAddress(), "notifyNotional", [toString(i.caller), 0], nil) | |
1035 | - | if ((notifyNotional == notifyNotional)) | |
1036 | - | then (((deletePosition(toString(i.caller)) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter)) ++ withdraw(i.caller, withdrawAmount)) ++ updateBalance(ammNewBalance)) | |
1037 | - | else throw("Strict value is not equal to itself.") | |
1038 | - | } | |
1039 | - | else throw("Strict value is not equal to itself.") | |
1040 | - | } | |
1041 | - | else throw("Strict value is not equal to itself.") | |
1042 | - | } | |
1043 | - | } | |
1001 | + | func closePosition () = { | |
1002 | + | let caller = getActualCaller(i) | |
1003 | + | let callerAddress = valueOrErrorMessage(addressFromString(caller), "Invalid caller") | |
1004 | + | if (if (if (!(requireOpenPosition(caller))) | |
1005 | + | then true | |
1006 | + | else !(initialized())) | |
1007 | + | then true | |
1008 | + | else paused()) | |
1009 | + | then throw("Invalid closePosition parameters") | |
1010 | + | else { | |
1011 | + | let $t04615246529 = internalClosePosition(caller, true) | |
1012 | + | let x1 = $t04615246529._1 | |
1013 | + | let positionBadDebt = $t04615246529._2 | |
1014 | + | let realizedPnl = $t04615246529._3 | |
1015 | + | let marginToVault = $t04615246529._4 | |
1016 | + | let quoteAssetReserveAfter = $t04615246529._5 | |
1017 | + | let baseAssetReserveAfter = $t04615246529._6 | |
1018 | + | let totalPositionSizeAfter = $t04615246529._7 | |
1019 | + | let cumulativeNotionalAfter = $t04615246529._8 | |
1020 | + | let openInterestNotionalAfter = $t04615246529._9 | |
1021 | + | let x2 = $t04615246529._10 | |
1022 | + | let totalLongAfter = $t04615246529._11 | |
1023 | + | let totalShortAfter = $t04615246529._12 | |
1024 | + | if ((positionBadDebt > 0)) | |
1025 | + | then throw("Unable to close position with bad debt") | |
1026 | + | else { | |
1027 | + | let withdrawAmount = abs(marginToVault) | |
1028 | + | let ammBalance = (cbalance() - withdrawAmount) | |
1029 | + | let $t04673846880 = if ((0 > ammBalance)) | |
1030 | + | then $Tuple2(0, abs(ammBalance)) | |
1031 | + | else $Tuple2(ammBalance, 0) | |
1032 | + | let ammNewBalance = $t04673846880._1 | |
1033 | + | let getFromInsurance = $t04673846880._2 | |
1034 | + | let x = if ((getFromInsurance > 0)) | |
1035 | + | then { | |
1036 | + | let withdrawInsurance = invoke(insuranceAddress(), "withdraw", [getFromInsurance], nil) | |
1037 | + | if ((withdrawInsurance == withdrawInsurance)) | |
1038 | + | then nil | |
1039 | + | else throw("Strict value is not equal to itself.") | |
1040 | + | } | |
1041 | + | else nil | |
1042 | + | if ((x == x)) | |
1043 | + | then { | |
1044 | + | let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [(withdrawAmount - getFromInsurance), toBase58String(quoteAsset())], nil) | |
1045 | + | if ((unstake == unstake)) | |
1046 | + | then { | |
1047 | + | let notifyNotional = invoke(minerAddress(), "notifyNotional", [caller, 0], nil) | |
1048 | + | if ((notifyNotional == notifyNotional)) | |
1049 | + | then (((deletePosition(caller) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter)) ++ withdraw(callerAddress, withdrawAmount)) ++ updateBalance(ammNewBalance)) | |
1050 | + | else throw("Strict value is not equal to itself.") | |
1051 | + | } | |
1052 | + | else throw("Strict value is not equal to itself.") | |
1053 | + | } | |
1054 | + | else throw("Strict value is not equal to itself.") | |
1055 | + | } | |
1056 | + | } | |
1057 | + | } | |
1044 | 1058 | ||
1045 | 1059 | ||
1046 | 1060 | ||
1047 | 1061 | @Callable(i) | |
1048 | 1062 | func liquidate (_trader) = { | |
1049 | 1063 | let spotMarginRatio = getMarginRatioByOption(_trader, PNL_OPTION_SPOT) | |
1050 | 1064 | let marginRatio = if (isOverFluctuationLimit()) | |
1051 | 1065 | then { | |
1052 | 1066 | let oracleMarginRatio = getMarginRatioByOption(_trader, PNL_OPTION_ORACLE) | |
1053 | 1067 | vmax(spotMarginRatio, oracleMarginRatio) | |
1054 | 1068 | } | |
1055 | 1069 | else spotMarginRatio | |
1056 | 1070 | if (if (if (if (!(requireMoreMarginRatio(marginRatio, maintenanceMarginRatio(), false))) | |
1057 | 1071 | then true | |
1058 | 1072 | else !(requireOpenPosition(_trader))) | |
1059 | 1073 | then true | |
1060 | 1074 | else !(initialized())) | |
1061 | 1075 | then true | |
1062 | 1076 | else paused()) | |
1063 | 1077 | then throw("Unable to liquidate") | |
1064 | 1078 | else if (if (if ((spotMarginRatio > liquidationFeeRatio())) | |
1065 | 1079 | then (partialLiquidationRatio() > 0) | |
1066 | 1080 | else false) | |
1067 | 1081 | then (DECIMAL_UNIT > partialLiquidationRatio()) | |
1068 | 1082 | else false) | |
1069 | 1083 | then { | |
1070 | - | let $ | |
1071 | - | let oldPositionSize = $ | |
1072 | - | let oldPositionMargin = $ | |
1073 | - | let oldPositionOpenNotional = $ | |
1074 | - | let oldPositionLstUpdCPF = $ | |
1084 | + | let $t04896049110 = getPosition(_trader) | |
1085 | + | let oldPositionSize = $t04896049110._1 | |
1086 | + | let oldPositionMargin = $t04896049110._2 | |
1087 | + | let oldPositionOpenNotional = $t04896049110._3 | |
1088 | + | let oldPositionLstUpdCPF = $t04896049110._4 | |
1075 | 1089 | let _direction = if ((oldPositionSize > 0)) | |
1076 | 1090 | then DIR_SHORT | |
1077 | 1091 | else DIR_LONG | |
1078 | 1092 | let isAdd = (_direction == DIR_LONG) | |
1079 | 1093 | let exchangedQuoteAssetAmount = getPartialLiquidationAmount(_trader, oldPositionSize) | |
1080 | - | let $ | |
1081 | - | let oldPositionNotional = $ | |
1082 | - | let unrealizedPnl = $ | |
1083 | - | let $ | |
1084 | - | let exchangedPositionSize = $ | |
1085 | - | let quoteAssetReserveAfter = $ | |
1086 | - | let baseAssetReserveAfter = $ | |
1087 | - | let totalPositionSizeAfter = $ | |
1088 | - | let cumulativeNotionalAfter = $ | |
1094 | + | let $t04933549439 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT) | |
1095 | + | let oldPositionNotional = $t04933549439._1 | |
1096 | + | let unrealizedPnl = $t04933549439._2 | |
1097 | + | let $t04944749737 = swapInput(isAdd, exchangedQuoteAssetAmount) | |
1098 | + | let exchangedPositionSize = $t04944749737._1 | |
1099 | + | let quoteAssetReserveAfter = $t04944749737._2 | |
1100 | + | let baseAssetReserveAfter = $t04944749737._3 | |
1101 | + | let totalPositionSizeAfter = $t04944749737._4 | |
1102 | + | let cumulativeNotionalAfter = $t04944749737._5 | |
1089 | 1103 | let realizedPnl = divd(muld(unrealizedPnl, abs(exchangedPositionSize)), abs(oldPositionSize)) | |
1090 | - | let $ | |
1091 | - | let remainMargin = $ | |
1092 | - | let badDebt = $ | |
1093 | - | let fundingPayment = $ | |
1104 | + | let $t04984450077 = calcRemainMarginWithFundingPayment(oldPositionSize, oldPositionMargin, oldPositionLstUpdCPF, realizedPnl) | |
1105 | + | let remainMargin = $t04984450077._1 | |
1106 | + | let badDebt = $t04984450077._2 | |
1107 | + | let fundingPayment = $t04984450077._3 | |
1094 | 1108 | let unrealizedPnlAfter = (unrealizedPnl - realizedPnl) | |
1095 | 1109 | let remainOpenNotional = if ((oldPositionSize > 0)) | |
1096 | 1110 | then ((oldPositionNotional - exchangedQuoteAssetAmount) - unrealizedPnlAfter) | |
1097 | 1111 | else ((unrealizedPnlAfter + oldPositionNotional) - exchangedQuoteAssetAmount) | |
1098 | 1112 | let liquidationPenalty = muld(exchangedQuoteAssetAmount, liquidationFeeRatio()) | |
1099 | 1113 | let feeToLiquidator = (liquidationPenalty / 2) | |
1100 | 1114 | let feeToInsurance = (liquidationPenalty - feeToLiquidator) | |
1101 | 1115 | let newPositionMargin = (remainMargin - liquidationPenalty) | |
1102 | 1116 | let newPositionSize = (oldPositionSize + exchangedPositionSize) | |
1103 | 1117 | let newPositionOpenNotional = abs(remainOpenNotional) | |
1104 | 1118 | let newPositionLstUpdCPF = latestCumulativePremiumFraction(newPositionSize) | |
1105 | 1119 | let openInterestNotionalAfter = (openInterestNotional() - exchangedQuoteAssetAmount) | |
1106 | 1120 | let ammBalance = (cbalance() - liquidationPenalty) | |
1107 | - | let $ | |
1121 | + | let $t05125051393 = if ((0 > ammBalance)) | |
1108 | 1122 | then $Tuple2(0, abs(ammBalance)) | |
1109 | 1123 | else $Tuple2(ammBalance, 0) | |
1110 | - | let newAmmBalance = $ | |
1111 | - | let takeFromInsurance = $ | |
1124 | + | let newAmmBalance = $t05125051393._1 | |
1125 | + | let takeFromInsurance = $t05125051393._2 | |
1112 | 1126 | let x = if ((takeFromInsurance > 0)) | |
1113 | 1127 | then { | |
1114 | 1128 | let withdrawInsurance = invoke(insuranceAddress(), "withdraw", [takeFromInsurance], nil) | |
1115 | 1129 | if ((withdrawInsurance == withdrawInsurance)) | |
1116 | 1130 | then nil | |
1117 | 1131 | else throw("Strict value is not equal to itself.") | |
1118 | 1132 | } | |
1119 | 1133 | else nil | |
1120 | 1134 | if ((x == x)) | |
1121 | 1135 | then { | |
1122 | 1136 | let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [(liquidationPenalty - takeFromInsurance), toBase58String(quoteAsset())], nil) | |
1123 | 1137 | if ((unstake == unstake)) | |
1124 | 1138 | then { | |
1125 | 1139 | let depositInsurance = invoke(insuranceAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), feeToInsurance)]) | |
1126 | 1140 | if ((depositInsurance == depositInsurance)) | |
1127 | 1141 | then { | |
1128 | 1142 | let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, newPositionOpenNotional], nil) | |
1129 | 1143 | if ((notifyNotional == notifyNotional)) | |
1130 | 1144 | then (((updatePosition(_trader, newPositionSize, newPositionMargin, newPositionOpenNotional, newPositionLstUpdCPF) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInterestNotionalAfter, (totalLongPositionSize() - (if ((newPositionSize > 0)) | |
1131 | 1145 | then abs(exchangedPositionSize) | |
1132 | 1146 | else 0)), (totalShortPositionSize() - (if ((0 > newPositionSize)) | |
1133 | 1147 | then abs(exchangedPositionSize) | |
1134 | 1148 | else 0)))) ++ withdraw(i.caller, feeToLiquidator)) ++ updateBalance(newAmmBalance)) | |
1135 | 1149 | else throw("Strict value is not equal to itself.") | |
1136 | 1150 | } | |
1137 | 1151 | else throw("Strict value is not equal to itself.") | |
1138 | 1152 | } | |
1139 | 1153 | else throw("Strict value is not equal to itself.") | |
1140 | 1154 | } | |
1141 | 1155 | else throw("Strict value is not equal to itself.") | |
1142 | 1156 | } | |
1143 | 1157 | else { | |
1144 | - | let $ | |
1145 | - | let x1 = $ | |
1146 | - | let badDebt = $ | |
1147 | - | let x2 = $ | |
1148 | - | let x3 = $ | |
1149 | - | let quoteAssetReserveAfter = $ | |
1150 | - | let baseAssetReserveAfter = $ | |
1151 | - | let totalPositionSizeAfter = $ | |
1152 | - | let cumulativeNotionalAfter = $ | |
1153 | - | let openInterestNotionalAfter = $ | |
1154 | - | let exchangedQuoteAssetAmount = $ | |
1155 | - | let totalLongAfter = $ | |
1156 | - | let totalShortAfter = $ | |
1158 | + | let $t05284953304 = internalClosePosition(_trader, false) | |
1159 | + | let x1 = $t05284953304._1 | |
1160 | + | let badDebt = $t05284953304._2 | |
1161 | + | let x2 = $t05284953304._3 | |
1162 | + | let x3 = $t05284953304._4 | |
1163 | + | let quoteAssetReserveAfter = $t05284953304._5 | |
1164 | + | let baseAssetReserveAfter = $t05284953304._6 | |
1165 | + | let totalPositionSizeAfter = $t05284953304._7 | |
1166 | + | let cumulativeNotionalAfter = $t05284953304._8 | |
1167 | + | let openInterestNotionalAfter = $t05284953304._9 | |
1168 | + | let exchangedQuoteAssetAmount = $t05284953304._10 | |
1169 | + | let totalLongAfter = $t05284953304._11 | |
1170 | + | let totalShortAfter = $t05284953304._12 | |
1157 | 1171 | let liquidationPenalty = muld(exchangedQuoteAssetAmount, liquidationFeeRatio()) | |
1158 | 1172 | let feeToLiquidator = (liquidationPenalty / 2) | |
1159 | 1173 | let feeToInsurance = (liquidationPenalty - feeToLiquidator) | |
1160 | 1174 | let ammBalance = (cbalance() - liquidationPenalty) | |
1161 | - | let $ | |
1175 | + | let $t05371653859 = if ((0 > ammBalance)) | |
1162 | 1176 | then $Tuple2(0, abs(ammBalance)) | |
1163 | 1177 | else $Tuple2(ammBalance, 0) | |
1164 | - | let newAmmBalance = $ | |
1165 | - | let takeFromInsurance = $ | |
1178 | + | let newAmmBalance = $t05371653859._1 | |
1179 | + | let takeFromInsurance = $t05371653859._2 | |
1166 | 1180 | let x = if ((takeFromInsurance > 0)) | |
1167 | 1181 | then { | |
1168 | 1182 | let withdrawInsurance = invoke(insuranceAddress(), "withdraw", [takeFromInsurance], nil) | |
1169 | 1183 | if ((withdrawInsurance == withdrawInsurance)) | |
1170 | 1184 | then nil | |
1171 | 1185 | else throw("Strict value is not equal to itself.") | |
1172 | 1186 | } | |
1173 | 1187 | else nil | |
1174 | 1188 | if ((x == x)) | |
1175 | 1189 | then { | |
1176 | 1190 | let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [(liquidationPenalty - takeFromInsurance), toBase58String(quoteAsset())], nil) | |
1177 | 1191 | if ((unstake == unstake)) | |
1178 | 1192 | then { | |
1179 | 1193 | let depositInsurance = invoke(insuranceAddress(), "deposit", nil, [AttachedPayment(quoteAsset(), feeToInsurance)]) | |
1180 | 1194 | if ((depositInsurance == depositInsurance)) | |
1181 | 1195 | then { | |
1182 | 1196 | let notifyNotional = invoke(minerAddress(), "notifyNotional", [_trader, 0], nil) | |
1183 | 1197 | if ((notifyNotional == notifyNotional)) | |
1184 | 1198 | then (((deletePosition(_trader) ++ updateAmm(quoteAssetReserveAfter, baseAssetReserveAfter, totalPositionSizeAfter, cumulativeNotionalAfter, openInterestNotionalAfter, totalLongAfter, totalShortAfter)) ++ withdraw(i.caller, feeToLiquidator)) ++ updateBalance(newAmmBalance)) | |
1185 | 1199 | else throw("Strict value is not equal to itself.") | |
1186 | 1200 | } | |
1187 | 1201 | else throw("Strict value is not equal to itself.") | |
1188 | 1202 | } | |
1189 | 1203 | else throw("Strict value is not equal to itself.") | |
1190 | 1204 | } | |
1191 | 1205 | else throw("Strict value is not equal to itself.") | |
1192 | 1206 | } | |
1193 | 1207 | } | |
1194 | 1208 | ||
1195 | 1209 | ||
1196 | 1210 | ||
1197 | 1211 | @Callable(i) | |
1198 | 1212 | func payFunding () = { | |
1199 | 1213 | let fundingBlockTimestamp = nextFundingBlockTimestamp() | |
1200 | 1214 | if (if (if ((fundingBlockTimestamp > lastBlock.timestamp)) | |
1201 | 1215 | then true | |
1202 | 1216 | else !(initialized())) | |
1203 | 1217 | then true | |
1204 | 1218 | else paused()) | |
1205 | 1219 | then throw(((("Invalid funding block timestamp: " + toString(lastBlock.timestamp)) + " < ") + toString(fundingBlockTimestamp))) | |
1206 | 1220 | else { | |
1207 | 1221 | let underlyingPrice = getOracleTwapPrice() | |
1208 | 1222 | let spotTwapPrice = getTwapSpotPrice() | |
1209 | 1223 | let premium = (spotTwapPrice - underlyingPrice) | |
1210 | - | let $ | |
1224 | + | let $t05544756782 = if (if ((totalShortPositionSize() == 0)) | |
1211 | 1225 | then true | |
1212 | 1226 | else (totalLongPositionSize() == 0)) | |
1213 | 1227 | then $Tuple2(0, 0) | |
1214 | 1228 | else if ((0 > premium)) | |
1215 | 1229 | then { | |
1216 | 1230 | let shortPremiumFraction = divd(muld(premium, fundingPeriodDecimal()), ONE_DAY) | |
1217 | 1231 | let longPremiumFraction = divd(muld(shortPremiumFraction, totalShortPositionSize()), totalLongPositionSize()) | |
1218 | 1232 | $Tuple2(shortPremiumFraction, longPremiumFraction) | |
1219 | 1233 | } | |
1220 | 1234 | else { | |
1221 | 1235 | let longPremiumFraction = divd(muld(premium, fundingPeriodDecimal()), ONE_DAY) | |
1222 | 1236 | let shortPremiumFraction = divd(muld(longPremiumFraction, totalLongPositionSize()), totalShortPositionSize()) | |
1223 | 1237 | $Tuple2(shortPremiumFraction, longPremiumFraction) | |
1224 | 1238 | } | |
1225 | - | let shortPremiumFraction = $ | |
1226 | - | let longPremiumFraction = $ | |
1239 | + | let shortPremiumFraction = $t05544756782._1 | |
1240 | + | let longPremiumFraction = $t05544756782._2 | |
1227 | 1241 | updateFunding((fundingBlockTimestamp + fundingPeriodSeconds()), (latestLongCumulativePremiumFraction() + longPremiumFraction), (latestShortCumulativePremiumFraction() + shortPremiumFraction), divd(longPremiumFraction, underlyingPrice), divd(shortPremiumFraction, underlyingPrice)) | |
1228 | 1242 | } | |
1229 | 1243 | } | |
1230 | 1244 | ||
1231 | 1245 | ||
1232 | 1246 | ||
1233 | 1247 | @Callable(i) | |
1234 | 1248 | func v_get (_trader) = { | |
1235 | - | let $ | |
1236 | - | let x1 = $ | |
1237 | - | let x2 = $ | |
1238 | - | let x3 = $ | |
1239 | - | let x4 = $ | |
1249 | + | let $t05715757217 = internalClosePosition(_trader, false) | |
1250 | + | let x1 = $t05715757217._1 | |
1251 | + | let x2 = $t05715757217._2 | |
1252 | + | let x3 = $t05715757217._3 | |
1253 | + | let x4 = $t05715757217._4 | |
1240 | 1254 | throw((((s(x2) + s(x3)) + s(x4)) + s(getMarginRatio(_trader)))) | |
1241 | 1255 | } | |
1242 | 1256 | ||
1243 | 1257 | ||
1244 | 1258 | ||
1245 | 1259 | @Callable(i) | |
1246 | 1260 | func view_calcRemainMarginWithFundingPayment (_trader) = { | |
1247 | - | let $ | |
1248 | - | let positionSize = $ | |
1249 | - | let positionMargin = $ | |
1250 | - | let pon = $ | |
1251 | - | let positionLstUpdCPF = $ | |
1252 | - | let $ | |
1253 | - | let positionNotional = $ | |
1254 | - | let unrealizedPnl = $ | |
1255 | - | let $ | |
1256 | - | let remainMargin = $ | |
1257 | - | let badDebt = $ | |
1258 | - | let fundingPayment = $ | |
1261 | + | let $t05736457475 = getPosition(_trader) | |
1262 | + | let positionSize = $t05736457475._1 | |
1263 | + | let positionMargin = $t05736457475._2 | |
1264 | + | let pon = $t05736457475._3 | |
1265 | + | let positionLstUpdCPF = $t05736457475._4 | |
1266 | + | let $t05748057581 = getPositionNotionalAndUnrealizedPnl(_trader, PNL_OPTION_SPOT) | |
1267 | + | let positionNotional = $t05748057581._1 | |
1268 | + | let unrealizedPnl = $t05748057581._2 | |
1269 | + | let $t05758657768 = calcRemainMarginWithFundingPayment(positionSize, positionMargin, positionLstUpdCPF, unrealizedPnl) | |
1270 | + | let remainMargin = $t05758657768._1 | |
1271 | + | let badDebt = $t05758657768._2 | |
1272 | + | let fundingPayment = $t05758657768._3 | |
1259 | 1273 | throw((((((s(remainMargin) + s(fundingPayment)) + s(getMarginRatio(_trader))) + s(unrealizedPnl)) + s(badDebt)) + s(positionNotional))) | |
1260 | 1274 | } | |
1261 | 1275 | ||
1262 | 1276 | ||
1263 | 1277 | ||
1264 | 1278 | @Callable(i) | |
1265 | 1279 | func forceMoveAsset (_trader,_amount) = if (if ((addressFromPublicKey(adminPublicKey()) != i.caller)) | |
1266 | 1280 | then true | |
1267 | 1281 | else (0 > _amount)) | |
1268 | 1282 | then throw("Invalid forceMoveAsset parameters") | |
1269 | 1283 | else { | |
1270 | 1284 | let unstake = invoke(quoteAssetStaking(), "unlockNeutrino", [_amount, toBase58String(quoteAsset())], nil) | |
1271 | 1285 | if ((unstake == unstake)) | |
1272 | 1286 | then (withdraw(addressFromStringValue(_trader), _amount) ++ updateBalance((cbalance() - _amount))) | |
1273 | 1287 | else throw("Strict value is not equal to itself.") | |
1274 | 1288 | } | |
1275 | 1289 | ||
1276 | 1290 | ||
1277 | 1291 | @Verifier(tx) | |
1278 | 1292 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], adminPublicKey()) | |
1279 | 1293 |
github/deemru/w8io/169f3d6 196.86 ms ◑