crytic / crytic/slither

[Bug-Candidate]: Slither python API contract with remappings file

Open
#2,530 6 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Python
Stars
6.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

### Describe the issue:

I use the slither by python API. If the contract use a mappings, Slither will go wrong. The reason is also "file not found, Searched the following locations: "".
The contract address is 0x51bdbfcd7656e2c25ad1bc8037f70572b7142ecc. In the Router.sol file,

import {Math} from "openzeppelin-math/Math.sol";
But the openzeppelin-math/Math.sol is remapped to lib/openzeppelin-contracts/contracts/utils/math/Math.sol
I use etherscan API to download the contract source code, the file system is like
https://etherscan.deth.net/address/0x51bdbfcd7656e2c25ad1bc8037f70572b7142ecc
My python3 code is

from slither.slither import Slither
ctsl = Slither('src/router/Router.sol')
How to solve this remappings problem in slither API?

### Code example to reproduce the issue:

from slither.slither import Slither
ctsl = Slither('src/router/Router.sol')

### Version:

0.10.3

### Relevant log output:

```shell
crytic_compile.platform.exceptions.InvalidCompilation: Invalid solc compilation Error: Source "openzeppelin-math/Math.sol" not found: File not found. Searched the following locations: "".
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.