# Lost fees due to precision loss in fees calculation

Kuiper Basket fee math divides mid-calculation, truncating remainders and leaking ~1% (up to 7.5%) of minted license fees.

- Payout: Audit contest
- Severity: medium
- Program: Kuiper
- Found by: kenzo
- Disclosed: 2022-05-02
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2021-12-defiprotocol-findings/issues/60
- Library page: https://bugbountylibrary.com/r/c4%3A2021-12-defiprotocol%3AM-08
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:precision-loss

**Target:** Solidity Basket contract fee/mint calculation
**Root cause:** Division is performed mid-formula (`timeDiff * licenseFee / ONE_YEAR`) so integer truncation discards remainder before subsequent multiplications, understating the fee.
**Steps:**
1. Read `Basket.sol#L140-L145`: `feePct = timeDiff * licenseFee / ONE_YEAR; fee = startSupply * feePct / (BASE - feePct)`
2. Note truncation of `feePct` before multiplying by `startSupply`
3. Recompute with division moved to end: `fee = startSupply * licenseFee * timeDiff / ONE_YEAR / (BASE - licenseFee)`
4. Compare minted fee amounts before/after; observe 1%-7% increase
**How found:** Code-reading of the fee formula spotted division occurring mid-calculation rather than at the end, then manual before/after comparison of minted fees confirmed the loss.
**Insight:** In Solidity fee/share formulas, check whether any division happens before the final step; truncation of an intermediate percentage compounds into systematic value leakage that judges treat as medium.
