15,000 USDC
View results
Submission Details
Severity: high

Liqudator can loose fund due to precision /rounding error

Summary

Liquidator will lose funds to precision if redeeming token amount is not a whole number.

Vulnerability Details

Lets say a liquidator wishes to liquidate USD 5000 in wbtc. (at USD10,000/wbtc).
From calculations in liquidate(), getTokenAmountFromUsd(wbtc,5000) should return 0 instead of 0.5.
#Zero amount is then passed to the _redeemCollateral(/**/) private and 0 transfered to the liquidator. This is a loss of liquidator funds as he gains nothing.

Impact

Liquidator will lose funds if redeeming token amount is in decimals (rounding down).

Tools Used

Foundry and Manual Review

Recommendations

Include precision in calculation.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.