PerpsV2 Mintaka -> Almach
Preamble
The Almach release marks the final set of significant improvements made against PerpsV2 whilst on the v2x system (barring any bugs or major issues). Unfortunately a small portion of improvements are backwards incompatible and has implications for those building keepers for liquidations, subgraphs for frontends, and contract interfaces for integrators.
This guide aims to provide details of each improvement and remedies for migration where exists.
Pull Request: https://github.com/Synthetixio/synthetix/pull/1994
Improvements & Remedies
New Liquidation Mechanism
You can read the full details described in SIP-2005. This change has implications for existing liquidation keepers.
canLiquidate
no longer returnstrue
when a liquidation can be liquidated but rathertrue
when an account can be flagged for liquidationliquidatePosition
can only liquidate a flagged position. Both the flagger and and liquidator are rewarded with fees upon liquidation. To flag a position, invokeflagPosition(address account)
Once a position is flagged, no modifications can be made until they are liquidated.
A
PositionFlagged(uint id, address account, address flagger, uint timestamp);
event is emitted when a position is flaggedTwo additional statuses pertaining to liquidations have been added to the
Status
enum:PositionFlagged
andPositionNotFlagged
Order Submission
You can find more details in SIP-2004. These changes have implications for frontends that interact with the PerpsV2 contracts.
priceImpactDelta
provided during order submission (open and close) for both off-chain orders, delayed orders, and atomic orders have been replaced withdesiredFillPrice
. You can and should still allow for user configurable slippage as input. However, to derive adesiredFillPrice
, you can:desiredFillPrice = side == 'short' ? fillPrice * (1 - priceImpactDelta) : fillPrice * (1 + priceImpactDelta)
A
close
convenience function has been introduced for off-chain and delayed orders:submitCloseOffchainDelayedOrderWithTracking
submitCloseDelayedOrderWithTracking
This behaves the same as
submit{Offchain}DelayedOrder
but without the need to specify asizeDelta
Off-chain and delayed orders no longer charge a commitment fee on submission. We also don't allow order cancellations until the orders become stale (i.e. past the window of settlement)
A subtle change has been made to all delayed order argument parameters for consistency
submitDelayedOrder(int sizeDelta, uint desiredTimeDelta, desiredFillPrice)
submitDelayedOrderWithTracking(int sizeDelta, uint desiredTimeDelta, desiredFillPrice, bytes32 trackingCode)
desiredTimeDelta
always comes beforedesiredFillPrice
. Previously it was inconsistent between methods
Orders that reduce a position, so long as the resulting position is not liquidatable will always be allowed and no longer will revert
Misc.
InvalidOrderPrice
removed fromStatus
enumInvalidOrderType
added toStatus
enumThe
PositionModified
event has been extended to include an additionalskew
property
Last updated