// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity =0.7.6; import '@aetherswap/periphery/contracts/interfaces/INonfungiblePositionManager.sol'; import '@aetherswap/core-contracts/contracts/interfaces/IAetherFactory.sol'; import '@aetherswap/core-contracts/contracts/interfaces/IAetherPool.sol'; import '@aetherswap/periphery/contracts/libraries/PoolAddress.sol'; /// @notice Encapsulates the logic for getting info about a NFT token ID library NFTPositionInfo { /// @param factory The address of the Aether Factory used in computing the pool address /// @param nonfungiblePositionManager The address of the nonfungible position manager to query /// @param tokenId The unique identifier of an Aether LP token /// @return pool The address of the Aether pool /// @return tickLower The lower tick of the Aether position /// @return tickUpper The upper tick of the Aether position /// @return liquidity The amount of liquidity staked function getPositionInfo( IAetherFactory factory, INonfungiblePositionManager nonfungiblePositionManager, uint256 tokenId ) internal view returns (IAetherPool pool, int24 tickLower, int24 tickUpper, uint128 liquidity) { address token0; address token1; uint24 fee; (, , token0, token1, fee, tickLower, tickUpper, liquidity, , , , ) = nonfungiblePositionManager.positions( tokenId ); pool = IAetherPool( PoolAddress.computeAddress( address(factory), PoolAddress.PoolKey({token0: token0, token1: token1, fee: fee}) ) ); } }