Uniswap / v3-periphery

🦄 🦄 🦄 Peripheral smart contracts for interacting with Uniswap v3
https://uniswap.org
GNU General Public License v2.0
1.16k stars 1.08k forks source link

Importing into contract. Remapping for Brownie #267

Open oroghene opened 2 years ago

oroghene commented 2 years ago

I am having trouble importing from Uniswap into Brownie. Here is my brownie-config.yaml file:

dependencies:
  - uniswap/v3-periphery@1.0.0
compiler:
  solc:
    remappings:
      - '@uniswap=uniswap/v3-periphery@1.0.0'

This is me importing in my solidity file:

import "@uniswap/contracts/interfaces/ISwapRouter.sol";
import "@uniswap/contracts/libraries/TransferHelper.sol";

I keep getting these errors:

.brownie/packages/uniswap/v3-periphery@1.0.0/contracts/libraries/TransferHelper.sol:4:1: ParserError: Source "@openzeppelin/contracts/token/ERC20/IERC20.sol" not found: File outside of allowed directories.
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
gosuto-inzasheru commented 2 years ago

so the TransferHelper.sol in the uniswap perepheries package relies on an import from @openzeppelin: https://github.com/Uniswap/v3-periphery/blob/22a7ead071fff53f00d9ddc13434f285f4ed5c7d/contracts/libraries/TransferHelper.sol#L4

try adding it as a dependency as well:

dependencies:
    - OpenZeppelin/openzeppelin-contracts@4.5.0

compiler:
    solc:
        remappings:
          - "@openzeppelin=OpenZeppelin/openzeppelin-contracts@4.5.0"
spaceh3ad commented 2 years ago

@gosuto-inzasheru this way he should also add uniswap v3-core, any way it does not solve the problem. @oroghene did you managed to resolve this? I am facing exactly same issue.