# Fee-on-transfer accounting divergence

Stored amounts or shares credited from requested amount, not measured balance delta after token moves

_Area: DeFi accounting and math bugs. Seen in 23 disclosed reports; latest 2025-09-11. Updated 2026-10-23._

## How it works
Code assumes moving `amount` of a token changes balances by exactly `amount`. Fee-on-transfer tokens (deduct a fee per transfer), rebasing/share tokens (balances change without transfers, or round down), and ERC4626 vaults or wrappers that charge their own deposit/withdrawal fee all break this: the recipient gets less, or the sender is debited more, than the number passed in. Any bookkeeping that records the requested amount instead of the measured balance delta then drifts from reality — shares, reserves, totalSupply, or liquidity become overstated or understated, and later math built on them is wrong.

## Where it shows up
- Deposit/mint paths that credit `_amount` to totals and mint shares from `_amount`, not from `balanceAfter - balanceBefore` [E7](https://bugbountylibrary.com/r/sherlock%3A2024-04-teller-finance%3AM-9.md)[E6](https://bugbountylibrary.com/r/c4%3A2025-08-morpheus%3AM-02.md).
- Paired mint/burn paths where one side uses pre-fee and the other post-fee amounts [E3](https://bugbountylibrary.com/r/c4%3A2024-11-nibiru%3AM-02.md).
- A transfer followed by a call telling a downstream contract to swap "the same amount" [E5](https://bugbountylibrary.com/r/c4%3A2024-06-thorchain%3AM-01.md).
- `_update`-style hooks that apply fees, reached again by internal `_burn`/`_mint` [E4](https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AM-11.md).
- Integrations with ERC4626 vaults that charge deposit/withdrawal fees, credited at nominal value [E1](https://bugbountylibrary.com/r/sherlock%3A2025-04-burve%3AH-1.md).
- Approvals sized to the nominal amount while the adapter pulls amount+fee [E4](https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AM-11.md).
- Bridge code hashing one amount into an ID while debiting/crediting a different one [E2](https://bugbountylibrary.com/r/c4%3A2022-06-connext%3AH-04.md).

## How to review
The invariant: every stored balance, share count, reserve, or supply must equal the sum of actual token movements, measured as balance deltas, never the requested amount. For each token-moving call, trace what value is recorded and compare it to what the token actually delivers. Check both directions (inbound and outbound) and both sides of any mint/burn pair. Confirm internal burn/mint paths do not re-enter fee hooks. Confirm any downstream call receives the post-fee amount actually held. Heuristic: grep for `balanceOf` before/after pairs; flag any stored amount not derived from a delta, and any place mixing delta-based and requested-amount accounting for the same token [E6](https://bugbountylibrary.com/r/c4%3A2025-08-morpheus%3AM-02.md).

## Variants seen
- Share/exchange-rate inflation from pre-transfer deposit accounting [E7](https://bugbountylibrary.com/r/sherlock%3A2024-04-teller-finance%3AM-9.md).
- Double fee application breaking supply backing [E3](https://bugbountylibrary.com/r/c4%3A2024-11-nibiru%3AM-02.md).
- Recursive fee on burn corrupting totalSupply [E4](https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AM-11.md).
- Pre-fee amount passed to downstream swap [E5](https://bugbountylibrary.com/r/c4%3A2024-06-thorchain%3AM-01.md).
- Ignored vault fee causing DoS on deposit [E1](https://bugbountylibrary.com/r/sherlock%3A2025-04-burve%3AH-1.md).
- Approval too small for amount+fee, reverting rebalances [E4](https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AM-11.md).
- Slippage-driven bridge amount divergence between debit and credit [E2](https://bugbountylibrary.com/r/c4%3A2022-06-connext%3AH-04.md).
- Mixed accounting styles for one token (delta vs requested) causing underflow DoS [E6](https://bugbountylibrary.com/r/c4%3A2025-08-morpheus%3AM-02.md).

## Impact and severity
Consequences in evidence: inflated exchange rates and fee-free deposits [E7](https://bugbountylibrary.com/r/sherlock%3A2024-04-teller-finance%3AM-9.md)[E1](https://bugbountylibrary.com/r/sherlock%3A2025-04-burve%3AH-1.md), unbacked coins in circulation [E3](https://bugbountylibrary.com/r/c4%3A2024-11-nibiru%3AM-02.md), corrupted supply and over-charged users [E4](https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AM-11.md), theft or DoS of aggregator funds [E5](https://bugbountylibrary.com/r/c4%3A2024-06-thorchain%3AM-01.md), drained router liquidity [E2](https://bugbountylibrary.com/r/c4%3A2022-06-connext%3AH-04.md), broken rebalances [E4](https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AM-11.md), and DoS of stake/withdraw/claim with yield loss [E6](https://bugbountylibrary.com/r/c4%3A2025-08-morpheus%3AM-02.md). Severity rises where the drift is exploitable for profit (E2, E5, E7) or silently mints value (E3, E4); DoS cases (E4, E6) are lower but still block core flows.

## Evidence
- E1: https://bugbountylibrary.com/r/sherlock%3A2025-04-burve%3AH-1.md
- E2: https://bugbountylibrary.com/r/c4%3A2022-06-connext%3AH-04.md
- E3: https://bugbountylibrary.com/r/c4%3A2024-11-nibiru%3AM-02.md
- E4: https://bugbountylibrary.com/r/sherlock%3A2025-01-peapods-finance%3AM-11.md
- E5: https://bugbountylibrary.com/r/c4%3A2024-06-thorchain%3AM-01.md
- E6: https://bugbountylibrary.com/r/c4%3A2025-08-morpheus%3AM-02.md
- E7: https://bugbountylibrary.com/r/sherlock%3A2024-04-teller-finance%3AM-9.md
- E8: https://bugbountylibrary.com/r/sherlock%3A2024-02-tapioca%3AM-28.md
