# `userTokens` accounting in `Launch.sol::updateParticipation` is updated incorrectly and can lead to loss of user funds, DOS and a broken invariant

Incorrect userTokens accounting in Launch.sol updateParticipation causes underflow, locking refunds and blocking cancellation for users reducing participation.

- Payout: Audit contest
- Severity: medium
- Program: Rova
- Found by: 0rpse
- Disclosed: 2025-02-13
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2025-02-rova-judging/issues/312
- Library page: https://bugbountylibrary.com/r/sherlock%3A2025-02-rova%3AM-2
- Tags: area:web3 domain:web3 impact:dos impact:funds-loss kind:contest platform:sherlock sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:dos

**Target:** Launch.sol smart contract
**Root cause:** When reducing participation, userTokens is decremented by refundCurrencyAmount instead of the token amount delta, causing an incorrect lower balance.
**Steps:**
1. User creates participation for 10000 tokens at 1.5 MOVE each (8 decimals).
2. User calls updateParticipation to reduce to 5000 tokens; refundCurrencyAmount = 7500 MOVE.
3. Contract sets userTokens to 10000e8 - 7500e8 = 2500e8 instead of 5000e8.
4. User attempts cancelParticipation; code computes userTokens - info.tokenAmount (2500e8 - 5000e8) and underflows.
5. User attempts processRefund; similar underflow occurs, locking funds.
**How found:** Code review of updateParticipation accounting logic; noticed subtraction of refundCurrencyAmount from userTokenAmount instead of token delta.
**Exploitation:** No direct theft; user triggers underflow by reducing then cancelling or claiming refund, causing denial of service and locked funds.
**Insight:** When updating user balances on partial withdrawals, always subtract the delta of the tracked asset, not a value denominated in another currency; check for decimal alignment between sale token and payment currency.

