# pause or kill gauge can lead to FLOW token stuck in voter

Pausing or killing a gauge zeroes its claimable FLOW without returning it to the minter, permanently stranding tokens in the Voter contract.

- Payout: Audit contest
- Severity: high
- Program: Velocimeter
- Found by: 0xBugHunter
- Disclosed: 2024-06-27
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-06-velocimeter-judging/issues/107
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-06-velocimeter%3AH-4
- 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:** Voter.sol pauseGauge/killGaugeTotally reward accounting
**Root cause:** pauseGauge and killGaugeTotally set claimable[_gauge] to zero without transferring the accrued FLOW back to the minter or distributing it, so the tokens remain in the Voter contract.
**Steps:**
1. Deploy FLOW, set minter, startActivePeriod, create three gauges.
2. Create locks and vote weights across the three pools.
3. Call `voter.pauseGauge(gauge3)`.
4. Skip 8 days and call `voter.distribute(gauge)`, `distribute(gauge2)`, `distribute(gauge3)`.
5. Observe gauge3 receives 0 FLOW while ~1000e18 FLOW remains stuck in the Voter contract.
**How found:** Code reading of Voter.distribute's `_claimable > left(base)` guard combined with pauseGauge/killGaugeTotally zeroing claimable without a transfer; confirmed with a Foundry test showing residual FLOW balance in Voter.
**Exploitation:** Emergency council pausing/killing a gauge causes its accrued claimable FLOW to be zeroed; the tokens are neither sent to the gauge nor returned to the minter, remaining permanently locked in Voter across epochs.
**Insight:** When a kill/pause path deletes an accounting entry, check whether the corresponding tokens are transferred out; compare against the upstream Velodrome V2 fix that returns claimable to the minter.

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

**Foundry test proving paused gauge leaves FLOW stuck**

```
function testPauseGaugeLeadToRemainingToken() public {
        FLOW.setMinter(address(minter));
        minter.startActivePeriod();
        voter.distribute();

        address gauge = voter.createGauge(address(pair),0);
        address gauge2 = voter.createGauge(address(pair2),0);
        address gauge3 = voter.createGauge(address(pair3),0);

        //get voting power.
        flowDaiPair.approve(address(escrow), 5e17);
        uint256 tokenId = escrow.create_lock_for(1e16, FIFTY_TWO_WEEKS,address(owner));
        uint256 tokenId2 = escrow.create_lock_for(1e16, FIFTY_TWO_WEEKS,address(owner2));
        uint256 tokenId3 = escrow.create_lock_for(1e16, FIFTY_TWO_WEEKS,address(owner3));

        skip(5 weeks);
        vm.roll(block.number + 1);

        address[] memory votePools = new address[](3);
        votePools[0] = address(pair);
        votePools[1] = address(pair2);
        votePools[2] = address(pair3);

        uint256[] memory weight = new uint256[](3);
        weight[0] = 10;
        weight[1] = 20;
        weight[2] = 30;

        //user vote.
        vm.prank(address(owner));
        voter.vote(tokenId,votePools,weight);

        vm.prank(address(owner2));
        voter.vote(tokenId2,votePools,weight);
 
        vm.prank(address(owner3));
        voter.vote(tokenId3,votePools,weight);

        voter.pauseGauge(gauge3);

        skip(8 days);
        voter.distribute(gauge);
        voter.distribute(gauge2);
        voter.distribute(gauge3);

        console2.log("gauge get flow:",FLOW.balanceOf(address(gauge)));
        console2.log("gauge2 get flow:",FLOW.balanceOf(address(gauge2)));
        console2.log("gauge3 get flow:",FLOW.balanceOf(address(gauge3)));
        console2.log("remaining flow:",FLOW.balanceOf(address(voter)));
    }
```

