Skip to content

v3 and v4 openzeppelin dependency conflict #454

@iamthe-nerdyDev

Description

@iamthe-nerdyDev
{
  "name": "contracts",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "type": "commonjs",
  "devDependencies": {
    "@nomicfoundation/hardhat-chai-matchers": "^2.1.0",
    "@nomicfoundation/hardhat-ethers": "^3.1.0",
    "@nomicfoundation/hardhat-ignition": "^0.15.13",
    "@nomicfoundation/hardhat-ignition-ethers": "^0.15.14",
    "@nomicfoundation/hardhat-network-helpers": "^1.1.0",
    "@nomicfoundation/hardhat-toolbox": "^6.1.0",
    "@nomicfoundation/hardhat-verify": "^2.1.1",
    "@typechain/ethers-v6": "^0.5.1",
    "@typechain/hardhat": "^9.1.0",
    "@types/chai": "^4.3.20",
    "@types/mocha": "^10.0.10",
    "@types/node": "^24.3.1",
    "chai": "^4.5.0",
    "ethers": "^6.15.0",
    "hardhat": "^2.26.3",
    "hardhat-gas-reporter": "^2.3.0",
    "solidity-coverage": "^0.8.16",
    "ts-node": "^10.9.2",
    "typechain": "^8.3.2",
    "typescript": "^5.9.2"
  },
  "dependencies": {
    "@openzeppelin/contracts": "^5.4.0",
    "@uniswap/universal-router": "^2.0.0",
    "@uniswap/v4-core": "^1.0.2",
    "@uniswap/v4-periphery": "^1.0.3",
    "permit2": "github:Uniswap/permit2",
    "solmate": "^6.8.0"
  }
}

above is my project package.json, when i run yarn hardhat compile, i get this error below:

Error HH411: The library @uniswap/v3-periphery, imported from @uniswap/universal-router/contracts/modules/MigratorImmutables.sol, is not installed. Try installing it using npm.

For more info go to https://hardhat.org/HH411 or run Hardhat with --show-stack-traces
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I then go ahead to install @uniswap/v3-periphery, it then goes ahead to throw an error due to that fact the it requires openzeppelin v3.4.** , while univeral router requires v5.*. the imports are messed up and my contract that imports UniversalRouter is not just compiling

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions