Precision Loss causing loss of funds to the liquidator
Summary
The contract is vulnerable to precision loss in _getLiquidationSeizeAmount which calculates teh amount that would be sent to the liquidator.
Which is introduced by division before multiplication.
josephdara
high
Precision Loss causing loss of funds to the liquidator
Summary
The contract is vulnerable to precision loss in
_getLiquidationSeizeAmount
which calculates teh amount that would be sent to the liquidator. Which is introduced by division before multiplication.Vulnerability Detail
In the function below,
Impact
This can cause operators to receive zero bonus and even loose their funds to the contract because the function is called in liquidate
Code Snippet
https://github.com/sherlock-audit/2023-05-ironbank/blob/main/ib-v2/src/protocol/pool/IronBank.sol#L821-L838
https://github.com/sherlock-audit/2023-05-ironbank/blob/main/ib-v2/src/protocol/pool/IronBank.sol#L505-L507
Tool used
Manual Review
Recommendation
All multiplications should happen before division