diff --git a/src/ReservoirPriceOracle.sol b/src/ReservoirPriceOracle.sol index 5781156..ca2ab7a 100644 --- a/src/ReservoirPriceOracle.sol +++ b/src/ReservoirPriceOracle.sol @@ -180,14 +180,6 @@ contract ReservoirPriceOracle is IPriceOracle, IReservoirPriceOracle, Owned(msg. } } - function _getTimeWeightedAverageSingle(OracleAverageQuery memory aQuery) private view returns (uint256 rResult) { - ReservoirPair lPair = pairs[aQuery.base][aQuery.quote]; - _validatePair(lPair); - - (,,, uint16 lIndex) = lPair.getReserves(); - rResult = lPair.getTimeWeightedAverage(aQuery.priceType, aQuery.secs, aQuery.ago, lIndex); - } - /// @inheritdoc IReservoirPriceOracle function getLatest(OracleLatestQuery calldata aQuery) external view returns (uint256) { ReservoirPair lPair = pairs[aQuery.base][aQuery.quote]; @@ -231,6 +223,14 @@ contract ReservoirPriceOracle is IPriceOracle, IReservoirPriceOracle, Owned(msg. if (address(aPair) == address(0)) revert OracleErrors.NoDesignatedPair(); } + function _getTimeWeightedAverageSingle(OracleAverageQuery memory aQuery) internal view returns (uint256 rResult) { + ReservoirPair lPair = pairs[aQuery.base][aQuery.quote]; + _validatePair(lPair); + + (,,, uint16 lIndex) = lPair.getReserves(); + rResult = lPair.getTimeWeightedAverage(aQuery.priceType, aQuery.secs, aQuery.ago, lIndex); + } + // TODO: replace this with safe, audited lib function function _calcPercentageDiff(uint256 aOriginal, uint256 aNew) internal pure returns (uint256) { if (aOriginal == 0) return 0;