# Base calculation in `Leverager::isLiquidateable()` is incorrect as the max leverage may be smaller

Leverager.isLiquidateable() computes base using vp.maxTimesLeverage instead of the lending pool's smaller maxLevTimes, underestimating base and skipping valid liquidations.

- Payout: Audit contest
- Severity: high
- Program: Yieldoor
- Found by: 0x73696d616f
- Disclosed: 2025-02-21
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2025-02-yieldoor-judging/issues/158
- Library page: https://bugbountylibrary.com/r/sherlock%3A2025-02-yieldoor%3AH-4
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:solidity technique:source-review vuln:accounting-error vuln:business-logic vuln:liquidation

**Target:** Leverager.sol isLiquidateable() liquidation logic
**Root cause:** Base divisor uses vp.maxTimesLeverage rather than the effective max leverage (min of vp.maxTimesLeverage and lending pool maxLevTimes), inflating the divisor and shrinking base.
**Steps:**
1. Configure lending pool maxLevTimes < vp.maxTimesLeverage.
2. Open a leveraged position via Leverager.
3. Drop collateral value so position should be liquidatable under actual max leverage.
4. Call isLiquidateable(): base = owedAmount*1e18/(vp.maxTimesLeverage-1e18) is too small, so check passes as healthy and liquidation is blocked.
**How found:** Code review of isLiquidateable() base formula, noticing the divisor uses vp.maxTimesLeverage while the lending pool enforces a possibly smaller maxLevTimes.
**Exploitation:** No active exploit; mispriced liquidation threshold lets undercollateralized positions persist, accruing bad debt for the protocol.
**Insight:** When a contract caches a config value (max leverage) but a downstream pool enforces its own cap, check every formula that assumes the cached value is the binding constraint; the effective limit is the min of both.

