Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions contracts/lendingPool/libraries/LiquidationLogic.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ library LiquidationLogic {
/// @notice An agent has been liquidated
event Liquidate(address indexed agent, address indexed liquidator, address asset, uint256 amount, uint256 value);

/// @notice No debt to liquidate
error NoDebt();

/// @dev Zero address not valid
error ZeroAddressNotValid();

Expand Down Expand Up @@ -65,6 +68,8 @@ library LiquidationLogic {
(uint256 totalDelegation, uint256 totalSlashableCollateral, uint256 totalDebt,,, uint256 health) =
ViewLogic.agent($, params.agent);

if (totalDebt == 0) revert NoDebt();

ValidationLogic.validateLiquidation(
health,
totalDelegation * $.emergencyLiquidationThreshold / totalDebt,
Expand Down