Decimal mismatch when calculating PT, YT, and SY prices
This issue is observed in the `PendleSySpotOracle` contract. The same problem also exists in `PendleYtSpotOracle` and `PendlePtSpotOracle`.
In the `getSafeSpotPriceInfo()` function, the `totalLpSupply` output is set to (10^{market.decimals}):
```solidity
totalLpSupply = 10 ** IERC20Metadata(market).decimals();
```
According to the Pendle market implementation, the market token always uses 18 decimals.
Reference:
```solidity
constructor(address _PT, int256 _scalarRoot, int256 _initialAnchor, uint80 _lnFeeRateRoot, address _gaugeController)
PendleERC20(_getLPName(_PT), _getLPSymbol(_PT), 18)
```
The returned `totalLpSupply` value is later used in `RootPriceOracle.getRangePricesLP()` to compute `safePriceInQuote` and `spotPriceInQuote`:
```solidity
// divide by total lp supply to get price per lp token
uint256 lpTokenDecimalsPad = 10 ** IERC20Metadata(lpToken).decimals();
safePriceInQuote = safePriceInQuote * lpTokenDecimalsPad / totalLPSupply;
spotPriceInQuote = spotPriceInQuote * lpTokenDecimalsPad / totalLPSupply;
```
The issue arises because `lpTokenDecimalsPad` uses the `lpToken`’s decimals rather than the market’s decimals. As a result, if the `lpToken` does not use 18 decimals, the computed prices will be incorrectly scaled, leading to inaccurate results.
Consider using the `lpToken`'s decimals to compute the `totalLpSupply` instead of the market's decimals.
{"description":"libraries/LibOwner.sol","title":"Abyss AMM Review","contributors":"[{\"id\":\"11b1c473-f182-44a7-81d2-590fdce28c40\",\"add\":295775,\"del\":348582,\"latestUpdatedAt\":1770787776555}]"}