# Executing withdrawToNativeChain with Zeta as fromToken will not be possible

withdrawToNativeChain with ZETA as fromToken reverts because mixSwap receives full msg.value while fromTokenAmount excludes the fee, breaking native-token swaps.

- Payout: Audit contest
- Severity: medium
- Program: Dodo Cross Chain Dex
- Found by: 10ap17
- Disclosed: 2025-05-29
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2025-05-dodo-cross-chain-dex-judging/issues/660
- Library page: https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AM-5
- Tags: area:web3 domain:web3 impact:dos kind:contest platform:sherlock sev:medium tech:evm tech:solidity vuln:accounting-error vuln:business-logic

**Target:** GatewayTransferNative.withdrawToNativeChain / DODORouteProxy.mixSwap
**Root cause:** _doMixSwap forwards full msg.value to mixSwap while fromTokenAmount was reduced by the fee; _deposit requires msg.value == amount for ETH, so the call reverts.
**Steps:**
1. User calls `withdrawToNativeChain` with zrc20 = native ZETA and amount == msg.value.
2. Fee is deducted from msg.value (assuming native fee payment works).
3. `_doMixSwap` calls `mixSwap{value: msg.value}(...)` with `fromTokenAmount = msg.value - fee`.
4. `mixSwap` calls `_deposit(..., amount=fromTokenAmount, isETH=true)`.
5. `require(msg.value == amount)` fails since msg.value > amount, reverting the swap.
**How found:** Code reading of the fee deduction path vs. the msg.value forwarded to mixSwap, spotting the msg.value == amount invariant in _deposit.
**Insight:** When a contract deducts fees from msg.value before an external call, check whether the forwarded value and the amount parameter stay consistent with downstream msg.value==amount invariants.

