# Liquidation bonus base miscalculation

Check every liquidation ratio, bonus and divisor uses debt repaid or effective cap as its base

_Area: DeFi oracles, liquidations and flash loans. Seen in 4 disclosed reports; latest 2024-06-17. Updated 2026-10-23._

## How it works
Liquidation math pairs a numerator (what the liquidator receives) with a base (what they repaid, what the position is worth, or which cap applies). The bug is a base mismatch: the ratio is computed from one quantity (a single token's share, private collateral, an equity term, a cached config value, an uncapped intermediate) but applied to another (total debt, all balances, the effective cap, the capped collateral). The invariant: seized collateral and bonus must be proportional to the debt actually repaid, valued on the same base, after all deductions; and any divisor must be the effective cap, not a cached or pre-cap value.

## Where it shows up
- Payout ratio built from a per-token share (share/oldShare) rather than total debt value [E1](https://bugbountylibrary.com/r/sherlock%3A2023-02-blueberry%3AH-6.md)
- A percentage computed on private collateral then applied to public balances too [E2](https://bugbountylibrary.com/r/c4%3A2024-02-wise-lending%3AH-04.md)
- Bonus numerator derived from an equity ratio (cappedCr - 1e18) instead of burned debt [E3](https://bugbountylibrary.com/r/c4%3A2024-04-dyad%3AM-01.md)
- A rate applied to a share before conversion to amount, skewing the solvency/liquidation threshold [E4](https://bugbountylibrary.com/r/c4%3A2023-07-tapioca%3AH-04.md)
- A surcharge computed from an uncapped intermediate but subtracted from a capped value [E5](https://bugbountylibrary.com/r/sherlock%3A2023-03-taurus%3AM-3.md)

## How to review
For each liquidation formula, name the numerator and base and confirm both refer to the same quantity:
- [E1](https://bugbountylibrary.com/r/sherlock%3A2023-02-blueberry%3AH-6.md)[E2](https://bugbountylibrary.com/r/c4%3A2024-02-wise-lending%3AH-04.md) Is the ratio normalized against total debt value, and applied to exactly the balance it was computed from?
- [E3](https://bugbountylibrary.com/r/c4%3A2024-04-dyad%3AM-01.md) Does the bonus numerator equal the debt repaid, not an equity or surplus term?
- [E4](https://bugbountylibrary.com/r/c4%3A2023-07-tapioca%3AH-04.md) Is every rate applied after share-to-amount conversion, consistent with sibling functions?
- [E5](https://bugbountylibrary.com/r/sherlock%3A2023-03-taurus%3AM-3.md) Is every fee/surcharge computed from the same capped value it is subtracted from?
- Does any divisor equal the effective cap (min of cached and downstream), not the cached value alone?

## Variants seen
- Per-token share ratio instead of total debt ratio, letting a small repayment seize all collateral [E1](https://bugbountylibrary.com/r/sherlock%3A2023-02-blueberry%3AH-6.md)
- Percentage on private collateral applied to public balance too [E2](https://bugbountylibrary.com/r/c4%3A2024-02-wise-lending%3AH-04.md)
- Bonus from equity instead of burned debt, shrinking incentive [E3](https://bugbountylibrary.com/r/c4%3A2024-04-dyad%3AM-01.md)
- Rate applied to share before amount conversion, skewing threshold [E4](https://bugbountylibrary.com/r/c4%3A2023-07-tapioca%3AH-04.md)
- Surcharge from uncapped value subtracted from capped value, reverting liquidation at extreme drops [E5](https://bugbountylibrary.com/r/sherlock%3A2023-03-taurus%3AM-3.md)

## Impact and severity
Overpayment lets liquidators drain collateral for a fraction of correct price [E1](https://bugbountylibrary.com/r/sherlock%3A2023-02-blueberry%3AH-6.md)[E2](https://bugbountylibrary.com/r/c4%3A2024-02-wise-lending%3AH-04.md); underpayment kills the incentive and leaves positions unliquidated [E3](https://bugbountylibrary.com/r/c4%3A2024-04-dyad%3AM-01.md); a share-vs-amount rate error misstates solvency and the liquidation threshold [E4](https://bugbountylibrary.com/r/c4%3A2023-07-tapioca%3AH-04.md); a surcharge exceeding the capped collateral reverts liquidation entirely at extreme price drops [E5](https://bugbountylibrary.com/r/sherlock%3A2023-03-taurus%3AM-3.md). Severity rises with multiple debt assets or balances, since the base mismatch scales with position complexity.

## Evidence
- E1: https://bugbountylibrary.com/r/sherlock%3A2023-02-blueberry%3AH-6.md
- E2: https://bugbountylibrary.com/r/c4%3A2024-02-wise-lending%3AH-04.md
- E3: https://bugbountylibrary.com/r/c4%3A2024-04-dyad%3AM-01.md
- E4: https://bugbountylibrary.com/r/c4%3A2023-07-tapioca%3AH-04.md
- E5: https://bugbountylibrary.com/r/sherlock%3A2023-03-taurus%3AM-3.md
