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.account
Control: from
matchedOrder.maker
.Constraints: N/A.
Impact: the address of the maker account.
params.subaccount
Control: from
matchedOrder.subaccount
.Constraints: N/A.
Impact: subaccount.
params.marginDelta
Control: the result of
market.processMakerFill
function execution +fundingPaymentResult.marginDelta
.Constraints: N/A.
Impact:
marginAccount.margin
data of the provided account and subaccount will be updated by themarginDelta
.
params.collateralDelta
Control: the result of
market.processMakerFill
function 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.debt
Control: the result of
market.processMakerFill
function execution +fundingPaymentResult.debt
Constraints: N/A.
Impact:
marginAccount.debt
data of the provided account and subaccount will be updated by thedebt
andmakerFee
.
params.makerFee
Control: the result of
getClearingHouse().getMakerFee(matchedOwner, matchData.quoteDelta)
function execution.Constraints: N/A.
Impact:
marginAccount.debt
data of the provided account and subaccount will be updated by thedebt
andmakerFee
.
params.close
Control: set up if subaccount was fully closed.
Constraints: N/A.
Impact: if true,
collateralDelta
is 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
.