我有一个智能合约叫Party.sol
pragma solidity 0.8.17;
import "../tokens/IERC721.sol";
import "./PartyGovernanceNFT.sol";
import "./PartyGovernance.sol";
字符串
我尝试使用slither提取调用图:
slither Party.sol --print call-graph
型
我得到这个错误:
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";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
型
为了正确读取导入,我需要对编译器或slither进行任何配置吗?
我得到了excly我所期望的,我把一个描述和代码,并得到了我所寻找的
1条答案
按热度按时间bejyjqdl1#
当使用slither分析
Party.sol
智能合约时遇到错误时,必须验证IERC721.sol
文件是否位于相对于Party.sol
的正确目录中。仔细检查import语句的相对路径也是至关重要的,因为
../tokens/IERC721.sol
建议IERC721.sol
文件应该位于Party.sol
位置上一级的目录中。如果需要,请考虑使用完整的绝对路径或配置slither以包含“tokens”目录的正确路径。
如果错误仍然存在,那么浏览crytic-compile库文档以获得关于编译契约的更多见解可能会有所帮助。