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