The liquidateAccounts
parameters are being passed wrongly to the deductAccountMargin
function which could lead unwanted consequences.
The liquidateAccounts
is a function meant to be called by the keepers in order to liquidate certain accounts that have gone below the required maintenance margin. Such accounts are said to be "under the water", hence are meant to be liquidated. While being liquidated, the orderFeeUsdX18
and settlementFeeUsdX18
are meant to be deducted from the account margin balance so as to reflect the true margin balance of the users account.
The settlementFeeUsdX18
is the total settlement fee to be deducted from the account while the orderFeeUsdX18
is the total order fee to be deducted from the account. This two variables are very unique to the protocol and serves two distinctive purpose, hence they should'nt be interchanged for one another.
But there is currently a mistake in how this variables are been passed to the deductAccountMargin
function.
The deductAccountMargin
aims to receive 5 different parameters as follows :-
However, the parameters being passed by the liquidateAccounts
is as follows :-
As seen from above, there's a wrong passing of input parameters which in this case is unintended and could lead various consequences.
Supposing the liquidateAccounts
is being called on a certain account which is currently "under the water" and liquidatable, the deductAccountMargin
is meant to reflect the realized PnL
of that account after the settlement fee and order fee have both been deducted. However, this wrong passing of input parameters could either understate or overstate the account PnL
.
And as showcased above, the order Fee is meant to be 0 during liquidation.
orderFeeUsdX18: UD60x18_ZERO,
While settlement Fee is meant to be the liquidation fee
ctx.liquidationFeeUsdX18 = ud60x18(globalConfiguration.liquidationFeeUsdX18);
Although both settlementFeeUsdX18
and orderFeeUsdX18
have similar implementation in the deductions from margin, but this is an underlying error that could lead to various casualties in other implementations.
Break of logic and wrong passing of input parameters which could lead to overstating or understating an account's PnL
Manual Review
Change how the input parameters are been passed to how they are being received.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.