Closed 0xfornax closed 1 year ago
Thank you for your report. I would like to clarify that the debt will never be less than the refund. This is because whenever the debt decreases, such as through a partial payoff, the refund will also be adjusted proportionally downwards. This adjustment is carried out through the functions VesselManager.decreaseVesselDebt and FeeCollector.decreaseDebt.
BOS-01M: Improper Handling of Refund
Description:
The potential refund a user would acquire from the
FeeCollector
as part of their vessel closure is factored in the repayment amount in the latest implementation ofBorrowerOperations
.A caveat of this adjustment is that if the
refund
received as part of a vessel's closure exceeds thedebt
the vessel has, the vessel would not be possible to close.Impact:
While a user will still be able to close their vessel by increasing its debt momentarily and invoking
BorrowerOperations::closeVessel
, the outlined behaviour is incorrect and can cause significant user distress.Example:
Recommendation:
We advise the code to properly handle such a case and to introduce a new argument to the
FeeCollector::closeDebt
call that signifies what value (if any) should be transmitted to the user as part of a vessel's closure given that thedebt
of the vessel may be less than therefund
acquired from theFeeCollector
.