# Allowance checked on wrong amount

Approvals or allowance checks on shares, pre-accrual, or pre-fee amounts while a larger value actually moves

_Area: DeFi accounting and math bugs. Seen in 3 disclosed reports; latest 2025-05-29. Updated 2026-10-29._

## How it works
An allowance is meant to bound what a spender can take from an owner. The bug appears when the number checked or approved is not the number that actually moves. Three shapes recur: a contract approves more than the downstream call consumes, leaving a residual allowance anyone can spend; a protocol computes a share/asset amount from a stale or conditionally-accrued state, then the real repay pulls more than the allowance covers; or a token hook moves funds outside the allowance accounting entirely. In each case the invariant "allowance >= value transferred" is silently violated.

## Where to show up
- `approve(x + y)` where the callee only pulls `x`, leaving `y` spendable [E1](https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AM-1.md)
- Contracts that hold refund/escrow balances and grant allowances to external contracts [E1](https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AM-1.md)
- Share amounts derived from `addInterest(false)` or other threshold-gated accrual, then repaid via a function that forces full accrual [E2](https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AM-33.md)
- `transferFrom` overrides that call fee/rebasing hooks before `super.transferFrom` [E3](https://bugbountylibrary.com/r/c4%3A2025-01-next-generation%3AM-01.md)
- Fee-on-top designs where the sender pays `amount + fee` but allowance covers only `amount` [E3](https://bugbountylibrary.com/r/c4%3A2025-01-next-generation%3AM-01.md)

## How to review
For every approve/allowance site, trace the exact amount the downstream contract pulls and compare to the amount approved or checked. The property: the approved/checked value must equal or exceed the value actually transferred, with no residual left spendable. For share math, confirm the accrual state used to compute shares matches the accrual forced inside the repay/transfer function. For token overrides, confirm all fund movements occur inside the allowance check, not before it.

## Variants seen
- Over-approval leaving residual gasFee allowance drainable via withdraw() [E1](https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AM-1.md)
- Conditional accrual vs forced accrual causing repay to exceed allowance, blocking deleverage [E2](https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AM-33.md)
- Fee deducted from sender before allowance check, letting spender drain beyond approval [E3](https://bugbountylibrary.com/r/c4%3A2025-01-next-generation%3AM-01.md)

## Impact and severity
Led to fund loss and DOS (refunds blocked) [E1](https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AM-1.md), blocked deleverage risking liquidation [E2](https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AM-33.md), and allowance bypass draining sender funds [E3](https://bugbountylibrary.com/r/c4%3A2025-01-next-generation%3AM-01.md). Severity rises when the contract holds pooled or refund balances, or when the failure blocks a safety-critical path like deleverage.

## Evidence
- E1: https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AM-1.md
- E2: https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AM-33.md
- E3: https://bugbountylibrary.com/r/c4%3A2025-01-next-generation%3AM-01.md
