# Incorrect number of shares minted as fee

Tokemak LMPVault mints fee shares using deposit formula, ignoring that only supply grows, so sink receives less than the owed fee.

- Payout: Contest reward
- Severity: high
- Program: Tokemak
- Credited: 0x007
- Disclosed: 2023-06-30
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2023-06-tokemak-judging/issues/624
- Library page: https://bugbountylibrary.com/r/sherlock%3A2023-06-tokemak%3AH-14
- Tags: domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:fee-bypass

**Target:** LMPVault.sol fee collection / _convertToShares
**Root cause:** Fee shares are computed as fees*totalSupply/totalAssets, but minting fees increases only totalSupply, not totalAssets, so each new share is worth less than the pre-mint NAV per share.
**Steps:**
1. State: profit=100 WETH, performanceFee=20%, totalSupply=100 shares, totalAssets=1000 WETH.
2. Code computes fees=20 WETH then shares=_convertToShares(20, Rounding.Up)=20*100/1000=2 shares.
3. Mint 2 shares to sink; post-mint value = 2*1000/(100+2)=19.6078 WETH < 20 WETH owed.
4. Correct formula: shares = profit*performanceFeeBps*totalSupply / (totalAssets*MAX_FEE_BPS - performanceFeeBps*profit) = 2.0408 shares, worth exactly 20 WETH.
**How found:** Code review of fee minting: noticed deposit mints increase both totalAssets and totalSupply keeping share value constant, while fee minting increases only totalSupply, so the same conversion formula under-values fee shares.
**Exploitation:** Not an attacker-driven exploit; protocol systematically under-mints fee shares to the sink on every fee collection, leaking fee value to existing holders.
**Insight:** When shares are minted without a matching asset inflow (fees, rewards, airdrops), the deposit conversion formula is wrong; solve for shares such that post-mint value equals the owed amount, as Lido's stETH fee formula does.
