# `getPrice` in `WeightedBPTOracle.sol`  uses `totalSupply` for price calculations which can lead to wrong results

WeightedBPTOracle.getPrice uses totalSupply instead of getActualSupply for Balancer BPT pricing, ignoring pre-minted BPT and protocol fees, yielding wrong LP prices.

- Payout: Contest reward
- Severity: medium
- Program: Blueberry
- Credited: Vagner
- Disclosed: 2023-07-12
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2023-07-blueberry-judging/issues/18
- Library page: https://bugbountylibrary.com/r/sherlock%3A2023-07-blueberry%3AM-2
- Tags: domain:web3 impact:funds-loss kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:source-review vuln:oracle-manipulation

**Target:** WeightedBPTOracle.sol price oracle for Balancer LP tokens
**Root cause:** getPrice computes BPT price using totalSupply for all pool types, but modern Weighted/Stable pools pre-mint BPT and accrue protocol fees, so totalSupply diverges from actual supply.
**Steps:**
1. Read WeightedBPTOracle.sol getPrice lines 71-73: price derived from invariant divided by totalSupply()
2. Compare Balancer docs: modern pools require getActualSupply(), Linear/legacy phantom pools getVirtualSupply(), only legacy pools use totalSupply()
3. Observe oracle applies totalSupply() unconditionally, overstating supply for pre-minted pools and understating price
**How found:** Cross-referenced Balancer documentation on BPT supply query functions against the oracle's unconditional totalSupply() call, spotting the mismatch for modern pool types.
**Insight:** When an oracle prices LP/BPT tokens, verify which supply function matches the pool variant (getActualSupply vs getVirtualSupply vs totalSupply); pre-minted BPT makes totalSupply wrong for modern Balancer pools.
