# Partial Liquidators can Cause the Last Liquidator to Suffer a Loss

In Peapods Fraxlend, partial liquidators take cleanLiquidationFee bonus while the final liquidator gets only leftover collateral, suffering losses up to 50%.

- Payout: Audit contest
- Severity: medium
- Program: Peapods Finance
- Found by: pkqs90
- Disclosed: 2025-01-08
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2025-01-peapods-finance-judging/issues/349
- Library page: https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AM-17
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:medium tech:evm tech:solidity vuln:accounting-error vuln:business-logic vuln:liquidation

**Target:** FraxlendPairCore liquidate() liquidation fee accounting
**Root cause:** Liquidation bonus is computed per-call using dirtyLiquidationFee when leftover collateral remains, so early partial liquidators extract the full bonus while the last liquidator receives only remaining collateral, less than the promised fee.
**Steps:**
1. Set pair maxLTV=95%, cleanLiquidationFee=6%.
2. Borrower position: 100 assets debt, 105.26 collateral (LTV 95%).
3. Liquidator_1 calls `liquidate(50e18, deadline, borrower)`; receives 52.7 collateral (50*1.054).
4. Remaining: 50 assets, 52.56 collateral.
5. Final liquidator repays 50 assets, receives 52.56 collateral = 5.12% bonus instead of promised 6%, a 0.88% loss.
6. With 90% partial liquidation first, remaining 10 assets vs 5.14 collateral, final liquidator suffers ~50% loss.
**How found:** Reasoned about fee accounting across sequential partial liquidations: noticed _collateralForLiquidator uses dirtyLiquidationFee whenever leftover collateral exists, then modeled balances after a 50% and 90% partial liquidation to show the last liquidator's effective bonus falls below the promised fee.
**Exploitation:** Liquidators front-run with large partial liquidations to capture cleanLiquidationFee bonus, leaving residual positions where the last liquidator's bonus is diluted or negative, disincentivizing cleanup of insolvent loans.
**Insight:** When a bonus/fee is computed per-call against a shared pool, model the state after N sequential partial calls; the last actor often absorbs the shortfall. Check whether fee tier selection (clean vs dirty) depends on remaining balance rather than cumulative liquidation.

