Slither not importing the required files

141 Views Asked by At

I have this smart contract called Party.sol

    pragma solidity 0.8.17;

    import "../tokens/IERC721.sol";

    import "./PartyGovernanceNFT.sol";
    import "./PartyGovernance.sol";

I'm trying to extract the call graph using slither :

    slither Party.sol --print call-graph
     

I get this error :

   crytic_compile.platform.exceptions.InvalidCompilation: Invalid solc compilation Error: Source "tokens/IERC721.sol" not found: File not found. Searched the following locations: "".
  --> Party.sol:4:1:
     |
     | import "../tokens/IERC721.sol";
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Is there any configuration I need to do to the compiler or slither in order to read correctly the imports?

I got exctly what I expected, I putted a description and code and got out what I looked for

1

There are 1 best solutions below

1
DevCrypto On

When encountering the error while analyzing the Party.sol smart contract with slither, it is essential to verify that the IERC721.sol file is located in the correct directory relative to Party.sol.

Double-checking the import statement's relative path is also crucial, as ../tokens/IERC721.sol suggests that the IERC721.sol file should be in a directory one level above the location of Party.sol Ensuring the accurate placement of files and correct import paths should usually resolve the issue.

If needed, consider using the full absolute path or configuring slither to include the correct path to the "tokens" directory.

If the error persists, it might be helpful to explore crytic-compile library documentation for additional insights on compiling contracts.