mythril
mythril copied to clipboard
Mythril cannot identify imported openzeppelin contracts in foundry project.
My mythril.solc.json
file looks like this:
{
"remappings": [
"@openzeppelin/contracts/access/=lib/openzeppelin-contracts/contracts/access/",
"@openzeppelin/contracts/utils/=lib/openzeppelin-contracts/contracts/utils/"
],
"optimizer":{
"enabled": true,
"runs": 500
}
}
The error i get:
abinash@hacek:~/Desktop/Lottery$ myth analyze ./src/Lottery.sol --solc-json mythril.solc.json
mythril.interfaces.cli [ERROR]: Traceback (most recent call last):
File "/home/abinash/.local/lib/python3.10/site-packages/mythril/interfaces/cli.py", line 966, in parse_args_and_execute
address = load_code(disassembler, args)
File "/home/abinash/.local/lib/python3.10/site-packages/mythril/interfaces/cli.py", line 717, in load_code
address, _ = disassembler.load_from_solidity(
File "/home/abinash/.local/lib/python3.10/site-packages/mythril/mythril/mythril_disassembler.py", line 297, in load_from_solidity
for contract in get_contracts_from_file(
File "/home/abinash/.local/lib/python3.10/site-packages/mythril/solidity/soliditycontract.py", line 132, in get_contracts_from_file
yield SolidityContract(
File "/home/abinash/.local/lib/python3.10/site-packages/mythril/solidity/soliditycontract.py", line 197, in __init__
).extract_features()
File "/home/abinash/.local/lib/python3.10/site-packages/mythril/solidity/features.py", line 31, in extract_features
all_require_vars.update(modifier_vars[modifier["modifierName"]["name"]])
KeyError: 'Ownable'
Can you try it with the develop version of the code and see if the issue still persists?
Yes, it is still persist.
Did you try v0.22.2
?
I have the same issue
ParserError: Source "@openzeppelin/contracts/access/AccessControl.sol" not found: File not found. Searched the following locations: "".
--> /nftTradingCards/src/Factory1155.sol:6:1:
|
6 | import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
Hi @derawl , this is a different issue, can you log a bug report for this?