# Multiple mints can brick any form of salesOption 3 mintings

NextGen salesOption 3 computes lastMintDate from circulating supply, so a second mint phase schedules mints far in the future, reverting with underflow and bricking minting.

- Payout: Contest reward
- Severity: high
- Program: NextGen
- Credited: 0x3b
- Disclosed: 2024-01-08
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2023-10-nextgen-findings/issues/380
- Library page: https://bugbountylibrary.com/r/c4%3A2023-10-nextgen%3AH-04
- Tags: domain:web3 impact:dos kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:business-logic vuln:dos

**Target:** MinterContract.sol minting logic (salesOption 3 periodic sales)
**Root cause:** lastMintDate is derived from allowlistStartTime plus timePeriod times (circulatingSupply - 1), so after a prior mint the computed timeOfLastMint exceeds block.timestamp, causing underflow in tDiff.
**Steps:**
1. Deploy collection with 1000 NFTs, complete first mint of 500.
2. Configure salesOption 3 phase: allowlistStartTime 4PM, timePeriod 1 min.
3. First user mints successfully since timeOfLastMint is within period.
4. Second user mints: lastMintDate = allowlistStartTime + 1min*(500-1) = ~8h19m later.
5. Subsequent mint calls revert with underflow as timeOfLastMint > block.timestamp.
**How found:** Reading the lastMintDate calculation and noticing it multiplies timePeriod by circulating supply minus one, which grows across mint phases instead of resetting per phase.
**Exploitation:** Any minter after the first triggers the miscalculated lastMintDate; the mint reverts with underflow, blocking all whitelisted and public mints for the phase.
**Escalation:** Larger prior supply or longer timePeriod pushes lastMintDate further into the future, bricking the entire mint process rather than just the whitelist.
**Insight:** When a scheduling formula uses cumulative supply as a time multiplier, check behavior across repeated phases—state that should reset per phase but doesn't will push computed timestamps past block.timestamp and underflow.
