0

I have been working through this project and at the point of trying to deploy the smart contract to the Roptsten test network, with connection through Infura.

I'm getting the following error when trying to deploy the ArbitrageFlashLoaner SC to Ropsten through Infura.io. Hardhat v2.7.1.

enter image description here HardhatError: HH404: File @openzeppelin/contracts/math/SafeMath.sol, imported from contracts/UniswapV2Library.sol, not found.

So I understand that it is unable to find @openzeppelin/contracts/math/SafeMath.sol from contracts/UniswapV2Library.sol, but I see that SafeMath.sol is in the relative path of node_modules:

enter image description here

UniswapV2Library.sol is a folder containing .json:

enter image description here

And the contents of UniswapV2Library.json:

{
  "_format": "hh-sol-artifact-1",
  "contractName": "UniswapV2Library",
  "sourceName": "contracts/UniswapV2Library.sol",
  "abi": [],
.
.
.

I'm stuck on what the path issue is in running npx hardhat.... The stacktrace doesn't really hep me. Is there a way to run this through some sort of IDE or put a watch on variable to see what the actual paths and variables are in all the files it uses (step through the process) while it's running, or where it's looking?

ElHaix
  • 12,846
  • 27
  • 115
  • 203

1 Answers1

1

@openzeppelin/contracts/math/SafeMath.sol was the path of the SafeMath.sol contract before the repository structure reorganization of the 22nd February 2021

(you can check that in detail here github.com/OpenZeppelin )

Now the new path is @openzeppelin/contracts/utils/math/SafeMath.sol.

So if I am not mistaken you can just change the path of your library import in your contract and it should work.

Saeid Amini
  • 1,313
  • 5
  • 16
  • 26
Benjamin
  • 11
  • 1