{
    "Function": "_getReferencePoolPriceX96",
    "File": "src/V3Oracle.sol",
    "Parent Contracts": [
        "src/interfaces/IErrors.sol",
        "lib/openzeppelin-contracts/contracts/access/Ownable.sol",
        "lib/openzeppelin-contracts/contracts/utils/Context.sol",
        "src/interfaces/IV3Oracle.sol"
    ],
    "High-Level Calls": [
        "TickMath",
        "IUniswapV3Pool",
        "FullMath",
        "IUniswapV3Pool"
    ],
    "Internal Calls": [],
    "Library Calls": [
        "mulDiv",
        "getSqrtRatioAtTick"
    ],
    "Low-Level Calls": [],
    "Code": "function _getReferencePoolPriceX96(IUniswapV3Pool pool, uint32 twapSeconds) internal view returns (uint256) {\n        uint160 sqrtPriceX96;\n        // if twap seconds set to 0 just use pool price\n        if (twapSeconds == 0) {\n            (sqrtPriceX96,,,,,,) = pool.slot0();\n        } else {\n            uint32[] memory secondsAgos = new uint32[](2);\n            secondsAgos[0] = 0; // from (before)\n            secondsAgos[1] = twapSeconds; // from (before)\n            (int56[] memory tickCumulatives,) = pool.observe(secondsAgos); // pool observe may fail when there is not enough history available (only use pool with enough history!)\n            int24 tick = int24((tickCumulatives[0] - tickCumulatives[1]) / int56(uint56(twapSeconds)));\n            sqrtPriceX96 = TickMath.getSqrtRatioAtTick(tick);\n        }\n\n        return FullMath.mulDiv(sqrtPriceX96, sqrtPriceX96, Q96);\n    }"
}