# If user merges their `veNFT`, they'll lose part of their rewards

Merging a veNFT burns the source token, so its unclaimed lagging-week rewards become unclaimable, causing permanent loss of funds.

- Payout: Audit contest
- Severity: high
- Program: Velocimeter
- Found by: Audinarey
- Disclosed: 2024-06-27
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-06-velocimeter-judging/issues/235
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-06-velocimeter%3AH-6
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** VotingEscrow / RewardsDistributor veNFT merge and claim
**Root cause:** RewardsDistributor lags at least one week behind last_token_time, and merge() burns the from token, so the burned tokenId can no longer claim its pending rewards.
**Steps:**
1. User holds veNFT `_from` with unclaimed rewards for the current lagging week.
2. User calls `merge(_from, _to)`; merge requires no attachments/votes and approval.
3. merge sets `locked[_from]=LockedBalance(0,0)`, checkpoints, then `_burn(_from)`.
4. RewardsDistributor.claim requires msg.sender to be owner/approved of the tokenId; burned token has no owner, so pending rewards for `_from` are unclaimable.
**How found:** Read claim loop breaking at `week_cursor >= _last_token_time` (rewards lag one week), then read merge() which burns the from token, realizing burned tokenId cannot pass claim's owner/approval check.
**Exploitation:** Any user merging their own veNFT loses at least one week of unclaimed rewards; no external attacker needed, loss is self-inflicted but unavoidable if merging before claiming.
**Insight:** When a token/NFT is burned or transferred, check every external module that keys state by that tokenId (reward distributors, bribes) for orphaned balances that become unclaimable.

## Proof of concept (copied exactly from the original report)

**merge function burns the from veNFT**

```
function merge(uint _from, uint _to) external {
        require(attachments[_from] == 0 && !voted[_from], "attached");
        require(_from != _to);
        require(_isApprovedOrOwner(msg.sender, _from));
        require(_isApprovedOrOwner(msg.sender, _to));

        LockedBalance memory _locked0 = locked[_from];
        LockedBalance memory _locked1 = locked[_to];
        uint value0 = uint(int256(_locked0.amount));
        uint end = _locked0.end >= _locked1.end ? _locked0.end : _locked1.end;

        locked[_from] = LockedBalance(0, 0);
        _checkpoint(_from, _locked0, LockedBalance(0, 0));
        _burn(_from);
        _deposit_for(_to, value0, end, _locked1, DepositType.MERGE_TYPE);
```

**claim loop stops before last_token_time**

```
for (uint i = 0; i < 50; i++) {
            if (week_cursor >= _last_token_time) break;
```

