[Ethereum] Slither Tool Error On Contract That Inherit From Openzeppeling

openzeppelinopenzeppelin-contractsreentrant-attacksSecuritysolidity

Hey Guys Hi ALl !
*I'm trying to use SLITHER (analizy tool ) but when i try to use it on a contract what inherit from Openzeppelin it give me this error(photo)
Error: Source "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol" not found: File not found."

Error: Source "@openzeppelin/contracts/access/Ownable.sol" not found: File not found.

This is My Contract :

contract WeakToken is ERC20Pausable, Ownable{
etc…….
}

enter image description here

Some of you used SLITHER Tool ?
And you try with contract what inherit from Openzeppeling ?*

Best Answer

Slither use crytic-compile for compiling your contracts. If you specify the path to your contract crytic-compile will try to compile it using your installed solc version. solc can't resolve your "@openzeppelin" imports. I am going to guess you are using some tooling like Hardhat or Truffle, if you are I would recommend using slither . instead of specifying the path to the contract; in this way, crytic can realize you are using a framework like Hardhat and compile with it.

Another solution could be using the --solc-remaps from crytici-compile, your command would be something like:

slither <path_to_your_contract> --solc-remaps @openzeppelin=node_modules/@openzeppelin

Answering your last questions: Yes, I have used slither with contracts that inherit from openzeppelin contracts. IMO The easiest way would be using Hardhat or Truffle.