{
    "Function": "getValue",
    "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": [],
    "Internal Calls": [
        "_getReferenceTokenPriceX96",
        "getPositionBreakdown",
        "_getReferenceTokenPriceX96",
        "_getReferenceTokenPriceX96",
        "_checkPoolPrice"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function getValue(uint256 tokenId, address token)\n        external\n        view\n        override\n        returns (uint256 value, uint256 feeValue, uint256 price0X96, uint256 price1X96)\n    {\n        (address token0, address token1, uint24 fee,, uint256 amount0, uint256 amount1, uint256 fees0, uint256 fees1) =\n            getPositionBreakdown(tokenId);\n\n        uint256 cachedChainlinkReferencePriceX96;\n\n        (price0X96, cachedChainlinkReferencePriceX96) =\n            _getReferenceTokenPriceX96(token0, cachedChainlinkReferencePriceX96);\n        (price1X96, cachedChainlinkReferencePriceX96) =\n            _getReferenceTokenPriceX96(token1, cachedChainlinkReferencePriceX96);\n\n        uint256 priceTokenX96;\n        if (token0 == token) {\n            priceTokenX96 = price0X96;\n        } else if (token1 == token) {\n            priceTokenX96 = price1X96;\n        } else {\n            (priceTokenX96,) = _getReferenceTokenPriceX96(token, cachedChainlinkReferencePriceX96);\n        }\n\n        value = (price0X96 * (amount0 + fees0) / Q96 + price1X96 * (amount1 + fees1) / Q96) * Q96 / priceTokenX96;\n        feeValue = (price0X96 * fees0 / Q96 + price1X96 * fees1 / Q96) * Q96 / priceTokenX96;\n        price0X96 = price0X96 * Q96 / priceTokenX96;\n        price1X96 = price1X96 * Q96 / priceTokenX96;\n\n        // checks derived pool price for price manipulation attacks\n        // this prevents manipulations of pool to get distorted proportions of collateral tokens - for borrowing\n        // when a pool is in this state, liquidations will be disabled - but arbitrageurs (or liquidator himself)\n        // will move price back to reasonable range and enable liquidation\n        uint256 derivedPoolPriceX96 = price0X96 * Q96 / price1X96;\n        _checkPoolPrice(token0, token1, fee, derivedPoolPriceX96);\n    }"
}