Liquidate maximum percentage is weighted
In the below liquidation code, there is a limit to the percent of an underwater user's debts liquidated in a single call to liquidate. The hardcoded constant percent is 20%.
public(friend) fun liquidate<P>(
// [..]
// we can liquidate up to 20% of the obligation's market value
let max_repay_value = min(
mul(
obligation.weighted_borrowed_value_usd,
decimal::from_percent(CLOSE_FACTOR_PCT)
),
borrow.market_value
);
However, as can be seen from the code above, the actual amount liquidatable in a single call is actually based on the weighted value of the debt. This is merely unusual and not a defect of the protocol.