Agora Docs

Liquidation

triggerSettle() is permissionless and settles a position when either side has fallen below its maintenance buffer, or when a take-profit or stop-loss level has been crossed. Settlement is at the current oracle mark. A side is liquidatable when payoutLong ≤ maintenanceLong or payoutLong ≥ escrow − maintenanceShort.

The keeper receives 1% of the settled escrow, taken from the liquidated side's residual buffer. There is no restriction on who may call: an address costs nothing, so any msg.sender predicate is bypassed with a second wallet. The fee comes from the liquidated side's own residual, so self-liquidation pays the fee out of the liquidated party's own collateral. A take-profit or stop-loss trigger pays no keeper fee.

Settlement requires a price no older than the market's priceMaxAge, bounded by the contract to between 60 seconds and 1 hour.

If no price has been posted for longer than 7 days, reclaimStale() becomes callable by anyone and refunds each party their own margin with no PnL applied. Escrow is conserved.

Either counterparty may close at the current mark with closePair(). There is no partial close: the position is a matched pair and closing settles both sides.