a position becomes eligible for liquidation if its under maintenance margin ratio. a margin ratio is the health of a position, it decreases as upnl decreases. at certain point, based on the leverage, the position needs to be liquidated.
anyone can become a liquidator as the function is open to call.
the deficit margin ratio on the position needs to be posted by the liquidator to bring it above maintenance margin ratio, and take over the position. post take over, the liquidator is free to do anything with it, as its just a normal position.
function liquidate(address amm, uint size, address trader, uint margin) external;
params
amm
amm addresssize
size to liquidate (wei)trader
trader to liquidatemargin
collateral to be posted (wei)