Skip to content

Unified Modeling Language (UML) class diagram generator for Solidity contracts

License

Notifications You must be signed in to change notification settings

Huynhhung0/sol2uml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

solidity-diagram-gen

UML class diagram generator for solidity contracts.

Install

Check out the repository from GitHub and npm install the dependencies

git clone https://github.com/naddison36/solidity-diagram-gen.git
npm install

Usage

To see the usage options

$ node sol2uml.js -h

Usage: sol2uml [options] <file or root folder>

Generates UML diagrams from Solidity source code

Options:
  -v, --verbose         With debugging statements
  -o, --output [value]  File outputs: svg, png or both (default: "svg")
  -h, --help            output usage information

To generate the test contracts in this repo

$ node sol2uml.js ./contracts

To generate a SVG diagram of all Solidity files under some root folder. Output will be a diagram.svg file in the working folder.

$ node sol2uml.js path/to/contracts/root/folder

To generate a SVG diagram of all contracts in a single Solidity file. Output will be a diagram.svg file in the working folder.

$ node sol2uml.js path/to/contracts/root/folder/solidity/file.sol

To generate SVG and PNG diagrams of all Solidity files under some root folder. Output will be diagram.svg and diagram.png files in the working folder.

$ node sol2uml.js -o both path/to/contracts/root/folder

Examples

Open Zeppelin 2.1.2

ERC20 Tokens

Open Zeppelin ERC20 Source folder

MakerDAO's SAI Token

dappsys DSToken Source file

About

This is a fork of the Richard Ramos's solidity-diagram-gen tool which no longer works as it uses the Solidity parser solidity-parser. This parser can not handle newer Solidity syntax like constructor.

This version uses the solidity-parser-antlr Solidity parser which is built on top of ANTLR4 grammar.

The diagrams are generated using viz.js which uses Graphviz to render a SVG file.

About

Unified Modeling Language (UML) class diagram generator for Solidity contracts

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 92.8%
  • JavaScript 7.2%