# `StopLimit` order cannot be filled under certain condition

StopLimit orders passing min-size check at creation revert when filled after price drop, because Bracket._createOrder re-checks min order size at the lower price.

- Payout: Audit contest
- Severity: medium
- Program: Oku
- Found by: xiaoming90
- Disclosed: 2024-11-22
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-11-oku-judging/issues/449
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-11-oku%3AM-9
- Tags: area:web3 domain:web3 impact:dos kind:contest platform:sherlock sev:medium tech:solidity technique:source-review vuln:business-logic

**Target:** StopLimit/Bracket order automation contracts
**Root cause:** Min order size is validated at StopLimit creation using current price, then re-validated in Bracket._createOrder at fill time when token price has dropped, making USD value fall below minOrderSize and reverting.
**Steps:**
1. Set MASTER.checkMinOrderSize = 100 USD; USDC price = 1.1 USD.
2. Bob creates StopLimit with tokenIn=USDC, amountIn=100e6, stopLimitPrice=100 USD; checkMinOrderSize passes (110 USD).
3. USDC price drops to 0.9 USD; order enters range; performUpkeep calls BRACKET_CONTRACT.fillStopLimitOrder.
4. Bracket._createOrder calls MASTER.checkMinOrderSize(USDC, 100e6) -> 90 USD < 100 USD -> revert.
5. StopLimit order can never be filled.
**How found:** Code reading of the double min-order-size check: once at StopLimit creation and again inside Bracket._createOrder during fill, noticing price movement between the two checks.
**Insight:** When a value/size threshold is enforced at order creation, check whether the same threshold is re-enforced at execution time against a changed oracle price; price drift between create and fill can brick order fulfillment.

