# Existing Circuit Breaker Implementation Allow Faster Taker To Extract Payout Tokens From Market

Bond SDA circuit breaker closes market only after a taker's purchase, letting the fastest taker drain payout tokens past maxDebt when quote token collapses.

- Payout: Contest reward
- Severity: medium
- Program: Bond
- Credited: hansfriese
- Disclosed: 2022-11-05
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2022-11-bond-judging/issues/21
- Library page: https://bugbountylibrary.com/r/sherlock%3A2022-11-bond%3AM-4
- Tags: domain:web3 impact:funds-loss kind:contest platform:sherlock sev:medium tech:solidity technique:source-review vuln:business-logic vuln:oracle-manipulation

**Target:** BondBaseSDA.sol market purchase / circuit breaker logic
**Root cause:** The circuit breaker check `if (term.maxDebt < market.totalDebt) _close(id_)` runs after the taker's purchase is already executed, so a single transaction can push totalDebt far past maxDebt before the market closes.
**Steps:**
1. Configure SDAM with term.maxDebt=110, maxPayout=100, market.totalDebt=99.
2. Quote token depegs to near zero.
3. Taker submits a purchase of 50 payout tokens in one tx; totalDebt becomes 149.
4. Circuit breaker fires only after the tx completes, so the 50 tokens are already sold at the collapsed price.
**How found:** Code review of the circuit breaker ordering in BondBaseSDA.sol; noticed the close happens after the purchase rather than capping the purchase amount.
**Exploitation:** When the quote token rapidly collapses, the fastest taker buys up to maxPayout in a single transaction; the circuit breaker closes the market only afterward, so the taker acquires payout tokens essentially for free at the depegged price.
**Insight:** When auditing circuit breakers or debt caps, check whether the limit is enforced before or after the state-changing action; a post-hoc close still lets one oversized transaction through.
