# Liquidation fee will not be claimed due to incorrect decimal handling

Leverager divides borrowed value by token decimals instead of 10^decimals, inflating debt so the liquidation-fee branch never executes and fee recipient gets nothing.

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

**Target:** Leverager.sol liquidatePosition borrowedValue calculation
**Root cause:** borrowedValue = owedAmount * bPrice / ERC20(denomination).decimals() divides by the raw decimals count (e.g. 18) instead of 10**decimals, inflating borrowedValue by ~1e17x so totalValueUSD > borrowedValue is never true.
**Steps:**
1. Set liquidationFee to 900 BPS and enable WETH as borrowed token.
2. Open leveraged position: 1 WBTC + 100000 USDC, denomination WETH, borrow ~35.52 WETH.
3. Drop WBTC price to 40000 and USDC to 0.5 so position value (90000 USD) is below debt but still above borrowed value.
4. Call `liquidatePosition` with id=1 as liquidator.
5. Observe feeRecipient WBTC/USDC balances are 0; logs show borrowedValue inflated to ~4.9e21 vs totalValueUSD ~9e4.
**How found:** Code review of the liquidation fee branch; noticed division by `decimals()` rather than `10 ** decimals`, then wrote a fork PoC logging totalValueUSD vs borrowedValue to confirm the branch is unreachable.
**Insight:** When auditing USD-value math, check every scaling divisor: `decimals()` returns a small integer (6/8/18), so dividing by it instead of `10**decimals` silently inflates values by ~1e17 and can make comparison branches dead code.

## Proof of concept (copied exactly from the original report)

**Forge command to run the PoC**

```
forge test --rpc-url $MAINNET_FORK_URL  --match-test test_cantClaimLiquidationFee --fork-block-number 21926708 -vvv
```

