```\nfunction getCumulativeTokenPrice() internal view returns (uint) {\n    uint cumulativePrice;\n\n    if (IUniswapV2Pair(pair).token0() == address(this)) {\n        cumulativePrice = IUniswapV2Pair(pair).price0CumulativeLast();\n    } else {\n        cumulativePrice = IUniswapV2Pair(pair).price1CumulativeLast();\n    }\n\n    if (cumulativePrice != 0) {\n        uint32 blockTimestamp = uint32(block.timestamp % 2**32);\n\n        (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = IUniswapV2Pair(pair).getReserves();\n\n        if (blockTimestampLast != blockTimestamp) {\n            uint32 timeElapsed = blockTimestamp - blockTimestampLast;\n\n            if (IUniswapV2Pair(pair).token0() == address(this)) {\n                cumulativePrice += FixedPoint.fraction(reserve1, reserve0) * timeElapsed;\n            } else {\n                cumulativePrice += FixedPoint.fraction(reserve0, reserve1) * timeElapsed;\n            }\n        }\n    }\n\n    return cumulativePrice;\n}\n```\n