DEV Community

rahuldev-17
rahuldev-17

Posted on • Edited on

How to understand long contracts with a visual tool: Sol2Uml

Have you ever faced difficulty in understanding a large solidity contract? If you answer in affirmative, you are in good company. Commercially deployed contracts on mainnet typically runs in ~800 to 1000 LOC. To wrap your brain around the whole contract just by scrolling might not be so useful. So let us explore a visual aid for this purpose: "Solidity to UML".

Let us first see its example on BSC scan (blockchain explorer-mainnet). On the contract page, click the on the "outline" button to get an overview of different interfaces, library and available abstract contracts(zoom in the image for clarity).

verified contract tab on BSC scan

To get a visual representation click on the "more options" dropdown list, and click on the "Sol2Uml" button(zoom in the image for clarity).

verified contract tab on BSC scan

A vector file(SVG) is generated which can be zoomed infinitely to view the call diagrams between class like structures of your contracts.

You can also use it to view contracts in your local environment by installing it as npm package. See details here.

Comment or ask if any further queries down below the box.

Top comments (0)