//SPDX-License-Identifier: Unlicense
pragma solidity ^0.7.6;
pragma abicoder v2;

import '@openzeppelin/contracts/token/ERC20/ERC20.sol';
import '@uniswap/v3-periphery/contracts/NonfungiblePositionManager.sol';
import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol';

contract V3Tool {
    NonfungiblePositionManager private positionManager;
    IUniswapV3Factory private factory;

    constructor(address payable _positionManager, address payable _factory) {
        positionManager = NonfungiblePositionManager(_positionManager);
        factory = IUniswapV3Factory(_factory);
    }

    struct PositionInfo {
        address lp;
        address token0;
        string symbol0;
        uint24 decimals0;
        uint256 r0;
        address token1;
        string symbol1;
        uint24 decimals1;
        uint256 r1;
        uint24 feei;
    }

    function getMoreInfo(address token0, address token1, uint24 fee) public view returns (
        address lp,
        string memory symbol0,
        uint24 decimals0,
        uint256 r0,
        string memory symbol1,
        uint24 decimals1,
        uint256 r1
    ) {
        ERC20 token0Obj = ERC20(token0);
        ERC20 token1Obj = ERC20(token1);

        address lp = factory.getPool(token0, token1, fee);

        return (lp, token0Obj.symbol(), token0Obj.decimals(), token0Obj.balanceOf(lp),
        token1Obj.symbol(), token1Obj.decimals(), token1Obj.balanceOf(lp));
    }
}
