# Incorrect precision assumed from RdpxPriceOracle creates multiple issues related to value inflation/deflation

Dopex's RdpxEthPriceOracle returns 1e18 precision while RdpxV2Core, UniV2LiquidityAmo and PerpetualAtlanticVault assume 1e8, inflating/deflating bond costs, LP value and premiums.

- Payout: Contest reward
- Severity: high
- Program: Dopex
- Credited: LokiThe5th
- Disclosed: 2023-12-29
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2023-08-dopex-findings/issues/549
- Library page: https://bugbountylibrary.com/r/c4%3A2023-08-dopex%3AH-07
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:oracle-manipulation vuln:precision-loss

**Target:** RdpxEthPriceOracle consumed by RdpxV2Core, UniV2LiquidityAmo, PerpetualAtlanticVault, ReLp
**Root cause:** RdpxEthPriceOracle.getRdpxPriceInEth() and getLpPriceInEth() return 1e18-scaled prices, but consuming contracts divide/multiply assuming 1e8 precision per their natspec.
**Steps:**
1. Read oracle natspec: `getRdpxPriceInEth()` returns price in 1e18 decimals
2. Read RdpxV2Core.getRdpxPrice() natspec: expects 1e8 precision
3. Compare consumers: `getLpTokenBalanceInWeth()` divides by 1e8; `calculatePremium()` divides by 1e8
4. Observe 1e10 scaling error propagates into calculateBondCost, calculateAmounts, _transfer, getLpPriceInEth, reLP, calculatePremium
**How found:** Cross-referenced oracle natspec (1e18) against consumer contract natspec and arithmetic (1e8 divisors), noting the mock oracle used in tests only returned 1e8 so the discrepancy slipped through.
**Exploitation:** Not a direct attack path; the mismatch causes systematic mispricing: rdpxRequired deflated in calculateBondCost, rdpxRequiredInWeth and premiums inflated, LP value overestimated, and possible underflow in _transfer.
**Insight:** When a protocol consumes its own oracle, diff the oracle's actual return decimals against every consumer's divisor/natspec; test mocks that hardcode the expected precision can mask a 1e10 scaling bug.
