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