# Self-referential slippage bounds

Min-out or expected output computed from the same spot price or pool state the trade moves

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

## How it works
A trade needs a floor on acceptable output. The protocol computes that floor from a price or pool state that the trade itself can move. The floor then tracks the manipulated value, so it never rejects a bad fill. The assumption that breaks: that the reference price is independent of the trade. When the reference is the same spot state the swap consumes, the check is self-referential and a sandwich always satisfies it.

## Where it shows up
- `amountOutMinimum` / min-amount derived from `slot0()`, spot reserves, or the same pool balances the swap touches [E3](https://bugbountylibrary.com/r/sherlock%3A2023-10-real-wagmi%3AH-4.md).
- A protocol-side slippage formula that mirrors the AMM's payout formula, differing only by a small discount [E1](https://bugbountylibrary.com/r/sherlock%3A2023-02-notional%3AH-3.md).
- Slippage minimum priced from feeds for a different asset than the one actually received (e.g. OP/USD for alUSD) [E2](https://bugbountylibrary.com/r/sherlock%3A2024-04-alchemix%3AH-1.md).
- Virtual price (a balanced-pool invariant) used as the reference for a one-sided withdrawal [E4](https://bugbountylibrary.com/r/c4%3A2023-05-xeth%3AM-07.md).
- Any `getExpectedExchange`/`_getMinExitAmounts`-style helper feeding a swap or liquidity removal.

## How to review
Identify the asset actually received and the exact state the trade moves. The invariant: the slippage floor must be derived from a source the trade cannot shift within the same transaction — a TWAP, an independent oracle for the received asset, or a caller-supplied bound. Check that the floor's formula differs from the AMM's payout formula; if both use the same spot balances, the check is a no-op [E1](https://bugbountylibrary.com/r/sherlock%3A2023-02-notional%3AH-3.md). Confirm the feed matches the output asset, not an intermediate or assumed peg [E2](https://bugbountylibrary.com/r/sherlock%3A2024-04-alchemix%3AH-1.md). For one-sided actions, verify the reference reflects that action, not a balanced-pool value [E4](https://bugbountylibrary.com/r/c4%3A2023-05-xeth%3AM-07.md).

## Variants seen
- Floor computed from the same spot balances as the AMM payout, with a discount that the payout never applies, so it can never trigger [E1](https://bugbountylibrary.com/r/sherlock%3A2023-02-notional%3AH-3.md).
- Floor priced from wrong-asset feeds, mispricing the minimum [E2](https://bugbountylibrary.com/r/sherlock%3A2024-04-alchemix%3AH-1.md).
- Floor derived from manipulable `slot0()` spot price, always tracking the sandwich [E3](https://bugbountylibrary.com/r/sherlock%3A2023-10-real-wagmi%3AH-4.md).
- Floor from virtual price understating a one-sided withdrawal amount [E4](https://bugbountylibrary.com/r/c4%3A2023-05-xeth%3AM-07.md).

## Impact and severity
Sandwich/MEV extraction of user or protocol value on swaps, redemptions and repayments; vault settlements exposed to slippage [E1](https://bugbountylibrary.com/r/sherlock%3A2023-02-notional%3AH-3.md)[E3](https://bugbountylibrary.com/r/sherlock%3A2023-10-real-wagmi%3AH-4.md). Severity is high where the bound is fully self-referential and the trade is large; lower where the mispricing is a partial underestimate [E4](https://bugbountylibrary.com/r/c4%3A2023-05-xeth%3AM-07.md). Worse when the manipulated state is cheap to move (thin pools, single-block spot reads).

## Evidence
- E1: https://bugbountylibrary.com/r/sherlock%3A2023-02-notional%3AH-3.md
- E2: https://bugbountylibrary.com/r/sherlock%3A2024-04-alchemix%3AH-1.md
- E3: https://bugbountylibrary.com/r/sherlock%3A2023-10-real-wagmi%3AH-4.md
- E4: https://bugbountylibrary.com/r/c4%3A2023-05-xeth%3AM-07.md
