Assessment reports>GTE -- Perp>Threat Model>_removeUnfillableOrder

Function: _removeUnfillableOrder(PerpBook ds, Order order)

This internal function removes a limit order from the order book if the maker and taker are the same (self-trade), the order has expired, and the maker position becomes liquidatable during the processMakerFill execution.

Branches and code coverage

Intended branches

  • collateralRefund is calculated correctly.

  • orderbookCollateral in the GTL contract is updated correctly.

  • The order is fully removed from the order book.

  • quoteTokenOpenInterest is updated properly when side == Side.BUY.

  • baseTokenOpenInterest is updated properly when side == Side.SELL.

Zellic © 2025Back to top ↑