[
](https://diligence.consensys.net)
[[ 🌐 ](https://diligence.consensys.net?utm_source=github_npm&utm_medium=banner&utm_campaign=surya) [ 📩 ](mailto:diligence@consensys.net) [ 🔥 ](https://consensys.github.io/diligence/)]
There is new flag (`-s`/`--simple`) that amkes the command chart only the *contract* call graph, instead of the function call graph. It's super useful for higher-level analyses!
**Accepted flags**
* `-i`/`--import` - Resolve all imports automatically by fetching the right files.
* `-c`/`--content` - Allow passing in file contents as arguments instead of file paths.
* `-s`/`--simple` - Only show calls between contracts, without specifying the functions.
* `-m`/`--modifiers` - **Enable** printing edges from functions to modifiers (when the latter are invoked in the function definitions).
* `-l`/`--libraries` - **Disable** printing edges from functions to libraries when the "Using ... for" syntax is in use (to prevent libraries like SafeMath from polluting the call graph).
### ftrace
The `ftrace` command outputs a _treefied_ function call trace stemming from the defined "CONTRACT::FUNCTION" and traversing "all|internal|external" types of calls.
External calls are marked in `orange` and internal calls are `uncolored`.
```shell
surya ftrace APMRegistry::_newRepo all MyContract.sol
```
**Accepted flags**
* `-i`/`--import` - Resolve all imports automatically by fetching the right files.
* `-c`/`--content` - Allow passing in file contents as arguments instead of file paths.
* `-j`/`--json` - Return a JSON object instead of a _treefied_ function call trace (mostly useful when Surya is being used as another package's dependency).
### flatten
The `flatten` command outputs a flattened version of the source code, with all import statements replaced by the corresponding source code. Import statements that reference a file that has already been imported, will simply be commented out.
```shell
surya flatten MyContract.sol
```
### describe
The `describe` command shows a summary of the contracts and methods in the files provided.
```shell
surya describe *.sol
```
Functions will be listed as:
* `[Pub]` public
* `[Ext]` external
* `[Prv]` private
* `[Int]` internal
A yellow `($)`denotes a function is `payable`.
A red `#` indicates that it's able to modify state.
**Accepted flags**
* `-i`/`--import` - Resolve all imports automatically by fetching the right files.
* `-c`/`--content` - Allow passing in file contents as arguments instead of file paths.
### inheritance
The `inheritance` command outputs a DOT-formatted graph of the inheritance tree. For Windows machines, the `>` should be replaced with `-o`.
```shell
surya inheritance MyContract.sol | dot -Tpng > MyContract.png
```
**Accepted flags**
* `-i`/`--import` - Resolve all imports automatically by fetching the right files.
* `-c`/`--content` - Allow passing in file contents as arguments instead of file paths.
### dependencies
The `dependencies` command outputs the [c3-linearization](https://en.wikipedia.org/wiki/C3_linearization) of a given contract's inheritance graph. Contracts will be listed starting with most-derived, ie. if the same function is defined in more than one contract, the solidity compiler will use the definition in whichever contract is listed first.
```shell
surya dependencies Exchange Exchange.sol
```
**Accepted flags**
* `-i`/`--import` - Resolve all imports automatically by fetching the right files.
* `-c`/`--content` - Allow passing in file contents as arguments instead of file paths.
### parse
The `parse` command outputs a _treefied_ AST object coming from the parser.
**Accepted flags**
* `-j`/`--json` - Return a JSON object instead of a _treefied_ object.
```shell
surya parse MyContract.sol
```
### mdreport
The `mdreport` command creates a Markdown description report with tables comprising information about the system's files, contracts and their functions. Much like describe but outputting to a nicely formatted Markdown file.
```shell
surya mdreport report_outfile.md MyContract.sol
```
## License
GPL-3.0
## Kudos
Created by @federicobond extended by @GNSPS