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