# Wrong balanceOf user after minting legendary gobbler

mintLegendaryGobbler double-counts the new legendary in gobblersOwned because _mint already increments it, making balanceOf return wrong values.

- Payout: Contest reward
- Severity: medium
- Program: Art Gobblers
- Credited: wagmi
- Disclosed: 2022-12-09
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2022-09-artgobblers-findings/issues/333
- Library page: https://bugbountylibrary.com/r/c4%3A2022-09-artgobblers%3AM-03
- Tags: domain:web3 impact:integrity kind:contest platform:code4rena sev:medium tech:evm tech:solidity vuln:accounting-error

**Target:** ArtGobblers.sol mintLegendaryGobbler / balanceOf accounting
**Root cause:** mintLegendaryGobbler subtracts cost and adds 1 to gobblersOwned, but _mint() already increments gobblersOwned for the new legendary, so the counter is off by one.
**Steps:**
1. Deploy ArtGobblers and warp past start time
2. Mint LEGENDARY_AUCTION_INTERVAL gobblers to users[0]
3. Reveal randomness so legendaryGobblerPrice()==69
4. Record balanceOf(users[0]) as beforeSupply
5. Call mintLegendaryGobbler(ids) with 69 gobbler ids as users[0]
6. Observe balanceOf(users[0]) == beforeSupply - cost + 1 instead of beforeSupply - cost
**How found:** Code reading of mintLegendaryGobbler line 458 noticed the manual +1 while _mint() already increments gobblersOwned, indicating double counting.
**Insight:** When a mint helper already updates per-user counters, audit any caller that also manually adjusts the same counter for the newly minted token.
