In the OdosRepayAdapter, a user can reduce their collateral to pay off debt. It will first remove collateral, swap it using an Odos call, adjust the position and then sell the minted coupons and pay off more debt.
It will prevent depositing too many debt tokens using this check:
In BorrowController it is not necessary, since the user knows ahead of time how much debt will be repaid. However, In the OdosRepayAdapter, this depends on coupon and collateral swaps.
Recommended mitigation
In case the remaining debt would be smaller than minDebtAmount, reduce the repay amount
accordingly.
In the OdosRepayAdapter, a user can reduce their collateral to pay off debt. It will first remove collateral, swap it using an Odos call, adjust the position and then sell the minted coupons and pay off more debt. It will prevent depositing too many debt tokens using this check:
https://github.com/clober-dex/coupon-finance/blob/216e0d9463b340ffcc810ecc81957ebe309048ec/contracts/OdosRepayAdapter.sol#L69-L71
However, it is missing a check could trip the execution in
settlePosition()
:https://github.com/clober-dex/coupon-finance/blob/216e0d9463b340ffcc810ecc81957ebe309048ec/contracts/LoanPositionManager.sol#L129
In BorrowController it is not necessary, since the user knows ahead of time how much debt will be repaid. However, In the OdosRepayAdapter, this depends on coupon and collateral swaps.
Recommended mitigation
In case the remaining debt would be smaller than minDebtAmount, reduce the repay amount accordingly.