Submitted by 0xRobocop
To not lose generality, the same issue is present in the LybraPEUSDVaultBase contract.
Liquidations are essential for a lending protocol to maintain the over-collateralization of the protocol. Hence, when a liquidation happens, it should increment the collateral ratio of the liquidated position (make it healthier).
The LybraEUSDVaultBase contract has a function named liquidation, which is used to liquidate users whose collateral ratio is below the bad collateral ratio, which for the eUSD Vault is 150%. This function incentives liquidators with a fixed reward of 10% of the collateral being liquidated. However, the issue with the fixed compensation is that it will cause a position to get unhealthier during a liquidation when the collateral ratio is 110% or smaller.
Take the following example:
The data above will give us a collateral ratio for the position of: 107.9%. The liquidator liquidates the max amount possible, which is 50% of the collateral, one ether, and takes 10% extra for its services; the final collateral ratio will be:
((2 - 1.1) * 1500) / (2779 - 1500) = 1.055
The position got unhealthier after the liquidation, from a collateral ratio of 107.9% to 105%. The process can be repeated until it is no longer profitable for the liquidator leading the protocol to accumulate bad debt.
I landed medium on this finding for the following reasons:
Manual Review
When a position has a collateral ratio below 110%, the reward percentage should be adjusted accordingly instead of a fixed reward of 10%.
Math
LybraFinance disagreed with severity and commented:
0xean (judge) decreased severity to Low
0xRobocop (warden) commented:
0xean (judge) increased severity to Medium and commented:
LybraFinance confirmed and commented:
