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 apositionResult
Execution of
collateralManager.settleTakerFill
Liquidation safety check
Processing of
takerFee
Branches and code coverage
Intended branches
fundingPaymentResult.marginDelta
is applied correctly topositionResult.marginDelta
.fundingPaymentResult.debt
is applied correctly topositionResult.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
.