In SynFutures@v1, if an account is no longer safe according to the current mark price (i.e. AccountBalance + UnrealizedPnL < Position * MarkPrice * MaintenanceMarginRatio), any user of the current futures contract can initiate a liquidation operation for the account. SynFutures@v1 supports two types of liquidate operations:
Traditional DeFi approach: The liquidator takes over all position of the liquidated account at the current mark price. Note that in this case the liquidator should ensure it has sufficient balance in the account to meet the position’s maintenance margin requirement. After all position of the liquidated account are closed, a penalty (deducted from the current account balance) is paid to the insurance fund according to the total value of the liquidation.
Automated Liquidator approach: To lower the liquidity requirement, liquidation initiators could utilize
liquidatebyAmm()method to use the liquidity in AMM's account, and force the accounts that need to be liquidated to trade with AMM with the same price logic as the trade function. Note that if the position that needs to be liquidated causes excessive price fluctuations in AMM after being traded to AMM, the liquidation process will fail.
It is worth mentioning that since AMM has always maintained liquidity in the system, partial liquidation becomes feasible under this operation: the account will be liquidated to a safe state that meets the initial margin requirement.