Submitted by 0x73696d616f
Whenever the price of a nft suffers a significant drop or the debt asset increases in price, there is a threshold after which liquidations are not profitable at all for the liquidator. Moreover, it does not offer the possibility of partial liquidation to at least partially mitigate this issue.
In LiquidationLogic::executeCrossLiquidateERC721(), the actual debt to liquidate is calculated in LiquidationLogic::_calculateDebtAmountFromERC721Collateral(). Here, it calculates the price of the liquidated nft by dividing the debt by the number of collateral tokens the user has. The problem with this approach is that it places no upper limit on the price, such that if the debt increases to much or the nft price suffers a sudden loss; the price of each nft would be too high. The amount of debt to repay is calculated based on this price, so it would make no sense for liquidators to pay an inflated amount for each nft.
Additionally, its possible to liquidate only a selected amount of nfts at a time by setting params.collateralTokenIds.length to less than the nft balance of the borrower, but it always sells them to the liquidator at the same inflated price. Thus, its impossible to use this mechanism to repay some amount of debt at a profitable price for the liquidator.
Place the following test in TestIntCrossLiquidateERC721.t.sol, confirming that the liquidator takes a big loss if the price of the nft collateral drops significantly.
Vscode, Foundry
Cap the price per nft of the liquidation to a reasonable value so liquidators can at least repay some of the token ids of the position. This is how it works for ERC20 liquidations, for example, in which the maximum debt to repay is calculated based on the maximum collateral balance sold at a discount.
thorseldon (BendDAO) acknowledged and commented:
0xTheC0der (judge) commented:
0x73696d616f (warden) commented:
0xTheC0der (judge) decreased severity to Medium and commented:
