Planned large liquidation fees will make liquidation not profitable causing bad debt
Summary
Planned large liquidation fees will make liquidation not profitable causing bad debt
Vulnerability Detail
The planned values for the liquidation fee and liquidation discount are (0-30%,10%)
Liquidation Fee = 0 (Might be increased to 20-30% in the future)
Liquidation Discount = 10% = 100000000000000000
The liqudation fee is taken directly from the captured assets and not the profits of the liquidator.
link
function _transferAssetsToLiquidator(address position, AssetData[] calldata assetData) internal {
uint256 fee = liquidationFee.mulDiv(assetData[i].amt, 1e18);
// transfer fee amt to protocol
Position(payable(position)).transfer(owner(), assetData[i].asset, fee);
// transfer difference to the liquidator
Position(payable(position)).transfer(msg.sender, assetData[i].asset, assetData[i].amt - fee);
Since the liquidation discount is capped to 10%, maxCapturableAmount will be:
hash
Medium
Planned large liquidation fees will make liquidation not profitable causing bad debt
Summary
Planned large liquidation fees will make liquidation not profitable causing bad debt
Vulnerability Detail
The planned values for the liquidation fee and liquidation discount are (0-30%,10%)
The liqudation fee is taken directly from the captured assets and not the profits of the liquidator. link
Since the liquidation discount is capped to 10%, maxCapturableAmount will be:
maxCapturableAmount = liquidatingAmount 100/(100-10) == 1.111 liquidationAmount
setting liquidation fee to anything greater than ((1.111 - 1)/1.111) * 100% == 9.99% will result in the liquidation being a loss for the liquidator
Impact
Liquidations won't happen causing bad debt and loss for the depositors
Code Snippet
https://github.com/sherlock-audit/2024-08-sentiment-v2/blob/main/README.md https://github.com/sherlock-audit/2024-08-sentiment-v2/blob/0b472f4bffdb2c7432a5d21f1636139cc01561a5/protocol-v2/src/PositionManager.sol#L466-L480
Tool used
Manual Review
Recommendation
Limit the liquidation fees
Duplicate of #91