{
    "Function": "slitherConstructorConstantVariables",
    "File": "contracts/UniswapV3Oracle.sol",
    "Parent Contracts": [
        "contracts/external/Ownable.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "contract UniswapV3Oracle is Ownable {\n\n  IUniswapV3Factory public constant uniFactory    = IUniswapV3Factory(0x1F98431c8aD98523631AE4a59f267346ea31F984);\n  ILinkOracle       public constant wethOracle    = ILinkOracle(0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419);\n  address           public constant WETH          = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\n  uint24            public constant WETH_POOL_FEE = 3000;\n\n  struct Pool {\n    address pairToken;\n    uint24  poolFee;\n  }\n\n  uint32 public twapPeriod;\n  uint   public minObservations;\n\n  IUniswapPriceConverter public uniPriceConverter;\n\n  mapping(address => Pool) public pools;\n\n  event PoolAdded(address indexed token);\n  event PoolRemoved(address indexed token);\n\n  constructor(\n    IUniswapPriceConverter _uniPriceConverter,\n    uint32       _twapPeriod,\n    uint         _minObservations\n  ) {\n    uniPriceConverter = _uniPriceConverter;\n    twapPeriod        = _twapPeriod;\n    minObservations   = _minObservations;\n  }\n\n  function addPool(\n    address _token,\n    address _pairToken,\n    uint24  _poolFee\n  ) external onlyOwner {\n\n    _validatePool(_token, _pairToken, _poolFee);\n\n    pools[_token] = Pool({\n      pairToken: _pairToken,\n      poolFee: _poolFee\n    });\n\n    emit PoolAdded(_token);\n  }\n\n  function removePool(address _token) external onlyOwner {\n    pools[_token] = Pool(address(0), 0);\n    emit PoolRemoved(_token);\n  }\n\n  function setUniPriceConverter(IUniswapPriceConverter _value) external onlyOwner {\n    uniPriceConverter = _value;\n  }\n\n  function setTwapPeriod(uint32 _value) external onlyOwner {\n    twapPeriod = _value;\n  }\n\n  function setMinObservations(uint _value) external onlyOwner {\n    minObservations = _value;\n  }\n\n  function tokenPrice(address _token) external view returns(uint) {\n    require(pools[_token].pairToken != address(0), \"UniswapV3Oracle: token not supported\");\n    _validatePool(_token, pools[_token].pairToken, pools[_token].poolFee);\n\n    uint ethValue = uniPriceConverter.assetToAssetThruRoute(\n      _token,\n      10 ** IERC20(_token).decimals(),\n      WETH,\n      twapPeriod,\n      pools[_token].pairToken,\n      [pools[_token].poolFee, WETH_POOL_FEE]\n    );\n\n    return ethValue * ethPrice() / 1e18;\n  }\n\n  function ethPrice() public view returns(uint) {\n    return wethOracle.latestAnswer() * 1e10;\n  }\n\n  function isPoolValid(address _token, address _pairToken, uint24 _poolFee) public view returns(bool) {\n    address poolAddress = uniFactory.getPool(_token, _pairToken, _poolFee);\n    if (poolAddress == address(0)) { return false; }\n\n    (, , , , uint observationSlots , ,) = IUniswapV3Pool(poolAddress).slot0();\n    return observationSlots >= minObservations;\n  }\n\n  function tokenSupported(address _token) external view returns(bool) {\n    return pools[_token].pairToken != address(0);\n  }\n\n  function _validatePool(address _token, address _pairToken, uint24 _poolFee) internal view {\n    require(isPoolValid(_token, _pairToken, _poolFee), \"UniswapV3Oracle: invalid pool\");\n  }\n}"
}