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