简体   繁体   中英

How to import UniswapV2Router02 interface into a smart contract on Truffle?

I am creating a sample Uniswap project and was able to import the Uniswap github interface as

import "https://github.com/Uniswap/uniswap-v2-periphery/blob/master/contracts/interfaces/IUniswapV2Router02.sol";

on Remix. However, in my local React-Js project (compiling with Truffle), this doesnt work. I tried installing the uniswap packages and doing

import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";

but I get this following error:

 ParserError: Source "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol" not found
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";

解决了 - 我在错误的目录(客户端而不是 root)中导入了 uniswap 包,所以松露无法识别

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM