Skip to content
A set of utilities for exploring Solidity contracts
Branch: master
Clone or download
Latest commit e475491 Mar 15, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.travis v0.2.8 - Maintenance update (#79) Feb 14, 2019
bin v0.2.8 - Maintenance update (#79) Feb 14, 2019
resources v0.2.8 - Maintenance update (#79) Feb 14, 2019
src v0.2.8 - Maintenance update (#79) Feb 14, 2019
test v0.2.8 - Maintenance update (#79) Feb 14, 2019
.babelrc
.editorconfig
.gitignore Initial commit Mar 23, 2018
.npmignore
.travis.yml
LICENSE v0.2.8 - Maintenance update (#79) Feb 14, 2019
README.md
RELEASING.md
package-lock.json Update parser Mar 15, 2019
package.json Update parser Mar 15, 2019

README.md

npm Build Status

Sūrya, The Sun God: A Solidity Inspector

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.

Getting Started

Install it via npm:

npm install -g surya

Command List

describe

The describe command shows a summary of the contracts and methods in the files provided.

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.

inheritance

The inheritance command outputs a DOT-formatted graph of the inheritance tree.

surya inheritance MyContract.sol | dot -Tpng > MyContract.png

graph

The graph command outputs a DOT-formatted graph of the control flow.

surya graph contracts/**/*.sol | dot -Tpng > MyContract.png

parse

The parse command outputs a "treefied" AST object coming from the parser.

surya parse MyContract.sol

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.

surya ftrace APMRegistry::_newRepo all MyContract.sol

dependencies

The dependencies command outputs the c3-linearization of a given contract's inheirtance 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.

surya dependencies Exchange Exchange.sol

mdreport

The 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.sol

License

GPL-3.0

Kudos

Created by @federicobond extended by @GNSPS

You can’t perform that action at this time.