# amount_claimable_per_share accounting is broken and will result in vault insolvency

Vault.vy claim accounting fails to initialize amount_claimed on new deposits, letting late depositors claim accrued WETH immediately and over-committing rewards until insolvency.

- Payout: Contest reward
- Severity: high
- Program: Fair Funding
- Credited: oxcm
- Disclosed: 2023-02-03
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2023-02-fair-funding-judging/issues/44
- Library page: https://bugbountylibrary.com/r/sherlock%3A2023-02-fair-funding%3AH-1
- Tags: domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:solidity technique:source-review vuln:accounting-error vuln:reward-distribution

**Target:** Vyper Vault contract claim/deposit accounting
**Root cause:** claimable amount is computed as shares_owned * amount_claimable_per_share - amount_claimed, but amount_claimed is not initialized to shares_issued * amount_claimable_per_share when a deposit occurs while amount_claimable_per_share != 0.
**Steps:**
1. User A deposits 1 ETH, receives 1 share.
2. Loan repays; 0.1 WETH becomes claimable, so amount_claimable_per_share = 0.1.
3. User B deposits 1 ETH, receives 1 share; position.amount_claimed stays 0.
4. User B calls claim: 1 * 0.1 - 0 = 0.1 WETH paid immediately.
5. Vault now owes 0.2 WETH total but holds only 0.1 WETH -> insolvency.
**How found:** Code review of the claim math in Vault.vy: noticed amount_claimed is only incremented on claim, never set at deposit time, so new shares inherit historical amount_claimable_per_share.
**Exploitation:** Any user deposits into the vault after yield has accrued (amount_claimable_per_share > 0) and immediately calls claim to withdraw a pro-rata share of previously accrued WETH they never earned, draining funds owed to earlier depositors.
**Insight:** In share-based reward accounting, any per-share accumulator must be snapshotted (debt/claimed initialized) at deposit time; check every path that mints shares for missing accumulator initialization.
