Liquidators might pay high gas fee costs on L1 and may not be incentivized to initiate liquidation
Summary
In some cases, liquidators would not be incentivized to liquidate a position.
Vulnerability Detail
If a borrower's position is undercollateralized, it may be liquidated by calling the repay() function. The incentive for a liquidator is the liquidationBonus that was provided by the borrower. Its minimum amount is 1e3. Since repay() function updates storage and calls to external functions like uniswap's swap (which costs ~2,029,753 gwei at the time of writng, or ~0.002 eth) and addLiquidity (which is another ~2mil), the liquidationBonus might not cover the gas costs of liquidating a position in some cases. The only party that would be interested in calling the repay() function in such cases would be uniswap position owners whos liquidity was borrowed. But then they would receive less fees than they are entitled to since burden of paying high gas costs are laid on them.
Impact
In some cases, only uniswap position owners are incentivized to liquidate borrowers at their own expense. This is clearly in contradiction with code logic where it is assumed that liquidators might be any users.
seeques
medium
Liquidators might pay high gas fee costs on L1 and may not be incentivized to initiate liquidation
Summary
In some cases, liquidators would not be incentivized to liquidate a position.
Vulnerability Detail
If a borrower's position is undercollateralized, it may be liquidated by calling the
repay()
function. The incentive for a liquidator is theliquidationBonus
that was provided by the borrower. Its minimum amount is 1e3. Sincerepay()
function updates storage and calls to external functions like uniswap's swap (which costs ~2,029,753 gwei at the time of writng, or ~0.002 eth) and addLiquidity (which is another ~2mil), theliquidationBonus
might not cover the gas costs of liquidating a position in some cases. The only party that would be interested in calling therepay()
function in such cases would be uniswap position owners whos liquidity was borrowed. But then they would receive less fees than they are entitled to since burden of paying high gas costs are laid on them.Impact
In some cases, only uniswap position owners are incentivized to liquidate borrowers at their own expense. This is clearly in contradiction with code logic where it is assumed that liquidators might be any users.
Code Snippet
https://github.com/sherlock-audit/2023-10-real-wagmi/blob/main/wagmi-leverage/contracts/LiquidityBorrowingManager.sol#L532-L674 https://github.com/sherlock-audit/2023-10-real-wagmi/blob/main/wagmi-leverage/contracts/LiquidityBorrowingManager.sol#L683-L703 https://github.com/sherlock-audit/2023-10-real-wagmi/blob/main/wagmi-leverage/contracts/libraries/Constants.sol#L16
Tool used
Manual Review
Recommendation
Make borrowers pay gas costs for liquidation.
Duplicate of #89