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

Function: _executeFillOrder(ClearingHouse self, byte[32] asset, address account, PostFillOrderArgs args)

The internal _executeFillOrder function handles the execution of filling orders. It performs the following:

  • Funding-payment settlement by calling settleFundingPayment

  • Execution of the market[asset].postFillOrder(...) function, which handles order execution and returns a positionResult

  • Execution of collateralManager.settleTakerFill

  • Liquidation safety check

  • Processing of takerFee

Branches and code coverage

Intended branches

  • fundingPaymentResult.marginDelta is applied correctly to positionResult.marginDelta.

  • fundingPaymentResult.debt is applied correctly to positionResult.debt.

  • The position is increased or decreased as expected.

  • If positionResult.fullClose == true, the position is removed from user positions.

  • Margin and debt balances are updated properly in settleTakerFill.

Zellic © 2025Back to top ↑