`MagicLpAggregator::latestAnswer` function will **always return 0** due to missing return in `_getReserves` function breaking all the logic wherever it is used to get price.
Audit: 2024-03-abracadabra-money-findings
Severity: MEDIUM

# Lines of code

https://github.com/code-423n4/2024-03-abracadabra-money/blob/main/src/oracles/aggregators/MagicLpAggregator.sol#L34
https://github.com/code-423n4/2024-03-abracadabra-money/blob/main/src/oracles/aggregators/MagicLpAggregator.sol#L42


# Vulnerability details

 

## Vulnerability Details

`MagicLpAggregator::_getReserves` is expected to return `baseReserve`and `quoteReserve` values but it will always return _(0,0)_ due to missing _return_ statement inside this function. Neither any named returned variable declared. Which will by default return _(0,0)_ from _returns (uint256, uint256)_ from `_getReserves` function.  
This `_getReserves` function is used inside `latestAnswer` function to get values of `baseReserve`and `quoteReserve`. Since these values will always be 0 due to coming from `_getReserves` function. And these values will still be 0 after multiplying at next lines(43&44). And final sum (`baseReserve + quoteReserve`)of these values will be also 0 which will make whole answer 0 by multiplying in `int256((minAnswer * (baseReserve + quoteReserve)) / pair.totalSupply())` return statement.

So `latestAnswer` will always return 0 since these both values sum is always be 0. Which will break whole purpose of getting price wherever it is used to get the price.

[src/oracles/aggregators/MagicLpAggregator.sol#L33-L46](https://github.com/code-423n4/2024-03-abracadabra-money/blob/main/src/oracles/aggregators/MagicLpAggregator.sol#L33-L46)

```solidity
33: function _getReserves() internal view virtual returns (uint256, uint256) {
     (uint256 baseReserve, uint256 quoteReserve) = pair.getReserves(); //@audit missing return statement to return these values so function will return 0,0 all the times. Named return also neither declared nor used.
  }

37:  function latestAnswer() public view override returns (int256) {
    uint256 baseAnswerNomalized = uint256(baseOracle.latestAnswer()) *
    (10 ** (WAD - baseOracle.decimals()));
    uint256 quoteAnswerNormalized = uint256(quoteOracle.latestAnswer()) *
    (10 ** (WAD - quoteOracle.decimals()));
    uint256 minAnswer = baseAnswerNomalized < quoteAnswerNormalized
    ? baseAnswerNomalized
    : quoteAnswerNormalized;

42:  (uint256 baseReserve, uint256 quoteReserve) = _getReserves(); //@audit will always return 0,0
43:  baseReserve = baseReserve * (10 ** (WAD - baseDecimals)); //still  0
44:  quoteReserve = quoteReserve * (10 ** (WAD - quoteDecimals)); //still 0
45:  return
    int256((minAnswer * (baseReserve + quoteReserve)) / pair.totalSupply()); //final sum of 0 will be multiplied here will make whole answer 0
}
```

## Impact

`latestAnswer` will always return 0 which will defeat whole purpose of getting price wherever it is used to get the price. SInce it will return always 0 price which is not expected from here.

## Tools Used

Manual Review

## Recommended Mitigation

Add `return` statement into `_getReserves` function. Which will return proper values of `baseReserve`and `quoteReser