Remix – Troubleshooting Library Import Issues from Uniswap Documentation in Remix

remixsolidityuniswap

I am looking how to implement liquidity pool from UniSwap documentation and getting error not found: Deferred import even when i just copy their example without any changes from my side i am getting the same error

i am trying to implement these :

import '@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol';
import '@uniswap/v3-core/contracts/libraries/TickMath.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import '@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol';
import '@uniswap/v3-periphery/contracts/interfaces/INonfungiblePositionManager.sol';
import '@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol';
import '@uniswap/v3-periphery/contracts/base/LiquidityManagement.sol';

Again..even when i copy their example i got error.I am using Remix ide

Best Answer

the way you import has to be done if you import via from your node_modules, in your case you should rather import directly from GitHub by including the link of the contract itself.

import "https://github.com/Uniswap/v3-core/blob/main/contracts/UniswapV3Pool.sol";
import "https://github.com/Uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import "https://github.com/Uniswap/v3-core/contracts/libraries/TickMath.sol";
import "https://github.com/Uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol";
import "https://github.com/Uniswap/v3-periphery/contracts/interfaces/INonfungiblePositionManager.sol";
import "https://github.com/Uniswap/v3-periphery/contracts/libraries/TransferHelper.sol";
import "https://github.com/Uniswap/v3-periphery/contracts/base/LiquidityManagement.sol";

for the IERC721Receiver.sol you need to find the right version to import or add directly to your remix and change the version.

Related Topic