pragma solidity ^0.7.6; import '@uniswap/v3-periphery/contracts/libraries/OracleLibrary.sol'; import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol'; import 'hardhat/console.sol'; contract Calc { IUniswapV3Factory factory = IUniswapV3Factory(0x1F98431c8aD98523631AE4a59f267346ea31F984); function getQuote(address tokenA, uint amountA, address tokenB, uint24 fee) public view returns (uint256 amountB) { (int24 tick,) = OracleLibrary.consult(factory.getPool(tokenA, tokenB, fee), 60); return OracleLibrary.getQuoteAtTick(tick, uint128(amountA), tokenA, tokenB); } }