Contract Diagram Generator (Inheritance and Calls)
Free to download on every platform. Comes pre-installed on BotFone, BotPad and BotFlip — with extra free apps included.
About this app
WHAT IT DOES
Contract Diagram Generator (Inheritance and Calls) helps you visualize the relationships between contracts in your project. You describe each contract—its name, type (contract, abstract, interface, or library), parent contract, and which other contracts it calls—and the tool generates a visual diagram showing inheritance hierarchies and function call patterns. The diagram displays contracts as nodes with color-coded borders based on their type, uses dashed purple arrows for inheritance relationships, and solid amber arrows for function calls. A legend explains the visual conventions. This is essential for understanding complex contract architectures, documenting system design, onboarding new developers, and planning upgrades that might affect inheritance or call chains. It's particularly useful for upgradeable contracts, proxy patterns, and large DeFi systems with many interconnected components.
HOW TO USE
Enter each contract on a separate line using the format: "name | type | parent | calls". For example: "MyToken | contract | ERC20 | IERC20,ERC20". The type field must be one of: contract, abstract, interface, or library. The parent field is optional—leave it blank if the contract has no parent. The calls field is a comma-separated list of contracts this contract calls—also optional. Click "Generate Diagram." The tool parses your input, validates the types, and builds a visual diagram with nodes positioned vertically. Inheritance relationships appear as dashed purple arrows pointing from child to parent. Call relationships appear as solid amber arrows pointing from caller to callee. The diagram automatically scales to fit all contracts, with each node showing the contract name and type.
THE REAL MECHANISM
The tool uses a pure JavaScript parser that operates entirely client-side. It splits each line on the pipe character to extract the contract name, type, parent, and call list. The tool validates that the type is one of the four allowed values and that parent and call targets reference valid contract names from the input. A simple vertical layout algorithm positions each contract node with padding and spacing, calculating the total diagram height dynamically. The diagram is rendered using absolute-positioned HTML elements with CSS styling, and SVG overlays for the arrows to ensure clean, scalable graphics. The color scheme uses purple for inheritance edges, amber for call edges, and different border colors for each contract type. No external libraries or API calls are required—all processing is done in the browser.
WHAT IT CANNOT SEE
This tool cannot automatically detect inheritance relationships from contract bytecode—it requires you to provide the relationships manually. It cannot generate diagrams for non-EVM contracts. It cannot produce interactive diagrams that respond to clicks or hovers. It cannot detect function calls between contracts without source code or manual input. It cannot generate diagrams for contracts without user-provided input. It cannot visualize contract state, storage layout, or internal function implementations. It cannot determine if a contract correctly implements an interface or if inheritance is valid. The tool does not fetch data from the blockchain or from compiled artifacts.
PLEASE NOTE
Contract Diagram Generator works for any EVM contract project and does not require a blockchain connection to function, though the network selector is provided for context. It is a documentation and visualization tool for developers, not an on-chain analysis tool. It reads data only and does not send any information to external servers. The tool is free to use and does not require authentication. For best results, keep contract names unique and ensure all referenced parent and call contracts are defined in the input.