# Precision loss in `boostPrice` in `V3AMO`

Integer division in SolidlyV3AMO.boostPrice rounds the price ratio down to 1 when stablecoin exceeds BOOST, breaking unfarmBuyBurn range checks.

- Payout: Audit contest
- Severity: medium
- Program: Axion
- Found by: 0x37
- Disclosed: 2024-10-07
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-10-axion-judging/issues/191
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-10-axion%3AM-4
- Tags: area:web3 domain:web3 impact:dos kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:source-review vuln:oracle-manipulation vuln:precision-loss

**Target:** SolidlyV3AMO.boostPrice() price oracle in liquidity-amo
**Root cause:** boostPrice divides (sqrtPriceX96**2 / Q96**2) before the outer division, so when sqrtPriceX96 >= Q96 the inner term truncates to 1, collapsing the reported price to a fixed value instead of the true sub-1 ratio.
**Steps:**
1. Deploy/initialize SolidlyV3Pool with sqrtPriceX96 = 87150978765690771352898345369 (10% above 2^96)
2. Call solidlyV3AMO.boostPrice()
3. Observe returned price = 1000000 instead of the correct sub-1 ratio
4. Call unfarmBuyBurn() and see it revert with PriceNotInRange since newBoostPrice > boostUpperPriceBuy
**How found:** Code review of the boostPrice branches; noticed the inner division (sqrtPriceX96**2 / Q96**2) truncates to 1 for sqrtPriceX96 slightly above Q96, then verified with a PoC initializing the pool 10% above 2^96.
**Insight:** When reviewing fixed-point price math, check the order of multiplications vs divisions: dividing an intermediate ratio before scaling by 10**decimals silently truncates to 1 for ratios near parity, so test prices just above/below the Q96 boundary.

## Proof of concept (copied exactly from the original report)

**Test showing incorrect boostPrice returned**

```
it("Showcases the incorrect price that is returned", async function() {
        console.log(await solidlyV3AMO.boostPrice()) // 1000000
})
```

**Initialize pool with sqrtPriceX96 above Q96**

```
pool = await ethers.getContractAt("ISolidlyV3Pool", poolAddress);
await pool.initialize(sqrtPriceX96);
```

