Surya is an utility tool for smart contract systems. It provides a number of visual outputs and information about the contracts' structure. Also supports querying the function call graph in multiple ways to aid in the manual inspection of contracts.
Currently only supports Solidity but we hope to extend the tool to encompass other languages.
The name stems from the sun deity Surya
Why the sun, you ask? Because "sun" in latin and portuguese is Sol.
Install it via npm:
npm install -g suryaThe describe command shows a summary of the contracts and methods in the files provided.
surya describe MyContract.solFunctions 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.
The inheritance command outputs a DOT-formatted graph of the inheritance tree.
surya inheritance MyContract.sol | dot -Tpng > MyContract.pngThe graph command outputs a DOT-formatted graph of the control flow.
surya graph MyContract.sol | dot -Tpng > MyContract.pngThe parse command outputs a "treefied" AST object coming from the parser.
surya parse MyContract.solThe 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.
surya ftrace APMRegistry::_newRepo all MyContract.solThe mdreport command creates a markdown description report with tables comprising information about the system's files, contracts and their functions.
surya mdreport report_outfile.md MyContract.solIf you want to run Surya over all the contracts in your Truffle project at once use this command at its root directory:
find contracts -name "*.sol" -print | xargs surya [some sub-command ...]GPL-3.0
Created by @federicobond extended by @GNSPS





