function getUniswapV3Price() public view returns (uint256) {
address uniswapV3PoolAddress = 0x99ac8cA7087fA4A2A1FB6357269965A2014ABc35; // Use the correct WBTC/USDC pool address for Uniswap V3
IUniswapV3Pool pool = IUniswapV3Pool(uniswapV3PoolAddress);
(uint160 sqrtPriceX96,,,,,,) = pool.slot0();
uint256 price = (uint256(sqrtPriceX96) ** 2 * 1e18) / (2 ** 192); // USDC/WBTC price
return price;
when i run this snippt, below error shows. How to fix this?
Error: call revert exception; VM Exception while processing transaction: reverted with panic code 17 [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method=”getUniswapV3Price()”, data=”0x4e487b710000000000000000000000000000000000000000000000000000000000000011″, errorArgs=[{“type”:”BigNumber”,”hex”:”0x11″}], errorName=”Panic”, errorSignature=”Panic(uint256)”, reason=null, code=CALL_EXCEPTION, version=abi/5.7.0)