Function: settleMakerFill(CollateralManager self, SettleMakerFillParams params)
This internal function performs maker-side accounting of margin and debt during the matching process after their limit order is partially or fully filled by a taker and calculates the collateralDelta to credit an account.
Inputs
params.accountControl: from
matchedOrder.maker.Constraints: N/A.
Impact: the address of the maker account.
params.subaccountControl: from
matchedOrder.subaccount.Constraints: N/A.
Impact: subaccount.
params.marginDeltaControl: the result of
market.processMakerFillfunction execution +fundingPaymentResult.marginDelta.Constraints: N/A.
Impact:
marginAccount.margindata of the provided account and subaccount will be updated by themarginDelta.
params.collateralDeltaControl: the result of
market.processMakerFillfunction execution -quoteAmountTraded(in the case of !reduceOnly and decreasing trade).Constraints: N/A.
Impact: if less than zero, account will be credited by
collateralDelta.
params.debtControl: the result of
market.processMakerFillfunction execution +fundingPaymentResult.debtConstraints: N/A.
Impact:
marginAccount.debtdata of the provided account and subaccount will be updated by thedebtandmakerFee.
params.makerFeeControl: the result of
getClearingHouse().getMakerFee(matchedOwner, matchData.quoteDelta)function execution.Constraints: N/A.
Impact:
marginAccount.debtdata of the provided account and subaccount will be updated by thedebtandmakerFee.
params.closeControl: set up if subaccount was fully closed.
Constraints: N/A.
Impact: if true,
collateralDeltais increased bydebt.
Branches and code coverage
Intended branches
Margin increases correctly when
marginDelta > 0.Margin decreases correctly when
marginDelta < 0.Collateral is updated according to
collateralDelta.