# If the vault's side token balance is 0 or a tiny amount, then most if not all IG Bear trades will revert due to incorrect check of computation error during delta hedge amount calculation

Smilee Finance's deltaHedgeAmount tolerance check divides sideTokensAmount by 10000, so when vault side-token balance is 0, any tiny computed sell amount reverts IG Bear trades.

- Payout: Contest reward
- Severity: medium
- Program: Smilee Finance
- Credited: panprog
- Disclosed: 2024-02-01
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-02-smilee-finance-judging/issues/100
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-02-smilee-finance%3AM-8
- Tags: domain:web3 impact:dos kind:contest platform:sherlock sev:medium tech:solidity technique:source-review vuln:business-logic vuln:dos

**Target:** FinanceIGDelta.deltaHedgeAmount in Smilee v2 contracts
**Root cause:** The computation-error tolerance is relative only (sideTokensAmount / 10000); when sideTokensAmount is 0 the tolerance is 0, so any nonzero tokensToSwap exceeds it and the trade reverts instead of being clamped.
**Steps:**
1. Deposit into vault and roll epoch so price trades above high boundary Kb with IG Bull used liquidity = 0, making vault side-token balance 0.
2. Call `ig.mint(charlie, strike, 0, optionAmountDown, premium, ...)` to buy an IG Bear option.
3. deltaHedgeAmount computes a tiny nonzero tokensToSwap; check `abs(tokensToSwap) - sideTokensAmount < sideTokensAmount/10000` becomes `x - 0 < 0`, false, so no clamp.
4. Transaction reverts, blocking the IG Bear trade.
**How found:** Code review of the delta hedge tolerance check: noticed the relative-only divisor yields zero tolerance when sideTokensAmount is 0, then reasoned about the vault state (price above Kb, zero IG Bull liquidity) that produces a zero side-token balance and confirmed with a Foundry PoC.
**Insight:** When auditing tolerance/clamping logic, test the boundary where the reference quantity is zero: relative-only tolerances collapse to zero and turn benign rounding dust into hard reverts.
