# Exponential and logarithmic price adapters will return incorrect pricing when moving from higher dp token to lower dp token

Exponential/logarithmic auction price adapters mis-scale prices when selling 18dp tokens for low-dp tokens, producing linear instead of exponential curves and wrong auction prices.

- Payout: Contest reward
- Severity: medium
- Program: Index
- Credited: 0x52
- Disclosed: 2023-06-20
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2023-06-Index-judging/issues/42
- Library page: https://bugbountylibrary.com/r/sherlock%3A2023-06-Index%3AM-5
- Tags: domain:web3 impact:funds-loss kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:precision-loss

**Target:** BoundedStepwiseExponential/LogarithmicPriceAdapter auction pricing
**Root cause:** scalingFactor is applied as a plain multiplier rather than via preciseMul, forcing expArgument/expExpression into the quote token's decimal scale; expWad/lnWad only behave correctly at 18dp, so at 6dp they degrade to linear behavior.
**Steps:**
1. Compute required price scale: price dp = 18 - component dp + quote dp; selling 1 WETH (18dp) for 2000 USDT (6dp) requires price = 2000e6.
2. Observe adapter applies `priceChange = scalingFactor * expExpression - WAD` with scalingFactor in the same dp as price (6dp).
3. Test in remix: `expWad(1e6)-WAD = 1e6`, `expWad(5e6)-WAD = 5e6`, `expWad(1000e6)-WAD = 1000e6` — perfectly linear, no exponential curve.
4. Conclude adapters cannot work when selling higher-dp to lower-dp tokens; auction prices deviate from intended curve.
**How found:** Reasoned from the price scaling formula in _calculateQuoteAssetQuantity (preciseMul requires price in WAD) and noticed scalingFactor is applied by plain multiplication, so it must share the price's dp; then tested expWad/lnWad at small (6dp) magnitudes in remix and found linear output.
**Insight:** When a fixed-point math library (expWad/lnWad) is used, verify the argument's decimal scale matches WAD; a plain-multiplied scaling factor silently forces the whole expression into the quote token's dp, breaking the curve for non-18dp tokens.
