# SwapUtils.sol Wrong implementation

SwapUtils._xp used stale stored tokenPrecisionMultipliers instead of computing from ramp target price, so owner's targetPrice ramp had no effect on pricing until reset.

- Payout: Audit contest
- Severity: high
- Program: Boot Finance
- Found by: WatchPug
- Disclosed: 2022-01-21
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2021-11-bootfinance-findings/issues/252
- Library page: https://bugbountylibrary.com/r/c4%3A2021-11-bootfinance%3AH-03
- Tags: area:web3 domain:web3 impact:integrity kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** SwapUtils.sol AMM price calculation (_xp)
**Root cause:** Price calculation used stored tokenPrecisionMultipliers rather than recomputing them in realtime from initialTargetPrice, futureTargetPrice, futureTargetPriceTime and current time, unlike getA()/getA2().
**Steps:**
1. Owner calls rampTargetPrice() to set a new target price.
2. Observe _xp() at L661 reads self.tokenPrecisionMultipliers (stored value) instead of deriving from ramp parameters.
3. Swaps continue pricing with old multipliers; new targetPrice only takes effect after another set or stopRampTargetPrice().
**How found:** Code reading: compared _xp() against getA()/getA2() which compute ramp values in realtime, noticed tokenPrecisionMultipliers was not recomputed from target price ramp state.
**Insight:** When a contract has time-based ramp logic (A, target price), check every consumer of the ramped parameter—any path reading a cached/stored value instead of recomputing from ramp state silently ignores the ramp.
