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