# Inflated price due to unnecessary precision scaling

IncentivePricingStats multiplies accumulated 18-decimal price by 1e18 during init, inflating filter prices ~1e18x and corrupting rebalance scoring.

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

**Target:** IncentivePricingStats stat calculator (Solidity)
**Root cause:** averagePrice multiplies _initAcc (already 18-decimal) by 1e18 before dividing by INIT_SAMPLE_COUNT, so fastFilterPrice/slowFilterPrice are seeded 1e18x too large and subsequent EMA updates stay skewed.
**Steps:**
1. Observe getPriceInEth returns 18-decimal price; _initAcc sums 18 samples of 2e18 = 36e18.
2. averagePrice = 36e18 * 1e18 / 18 = 2e36, assigned to fast/slowFilterPrice.
3. Post-init getFilteredValue(FAST_ALPHA, 2e36, 3e18) yields ~1.34e36 instead of ~3e18.
4. Solver uses inflated composite return to approve unprofitable rebalance.
**How found:** Code reading of the init branch: noticed getPriceInEth already returns 18 decimals, making the extra *1e18 in averagePrice redundant and inflating the seeded filter values.
**Exploitation:** No direct attacker path; inflated stat prices feed the solver's composite return, causing it to execute unprofitable rebalances that drain vault value.
**Insight:** When a helper already returns a fixed-decimal value, audit every downstream scaling for double-scaling; seeded EMA/filter state persists and skews all later updates, so check init-phase math separately from steady-state.
