How Does a Smart Contract Enforce the Margin Call Process for a Perpetual Futures Contract?
The smart contract continuously monitors the maintenance margin level of a user's position against the current mark price. If the margin ratio falls below a predefined threshold, the contract's liquidation function becomes callable.
A 'keeper' bot or another user can then call this function, which automatically liquidates a portion of the collateral to cover the deficit and bring the margin back to a safe level.