{"id":15065184,"url":"https://github.com/shaunazzopardi/solidity-cfg-builder","last_synced_at":"2025-04-10T13:23:02.600Z","repository":{"id":134362262,"uuid":"121997729","full_name":"shaunazzopardi/solidity-cfg-builder","owner":"shaunazzopardi","description":"A control-flow graph builder for Solidity smart contracts.","archived":false,"fork":false,"pushed_at":"2019-12-04T21:23:59.000Z","size":72,"stargazers_count":26,"open_issues_count":4,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T12:09:03.846Z","etag":null,"topics":["control-flow-graph","ethereum-verificaton","solidity","solidity-analysis","solidity-contracts","solidity-language","static-analysis"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shaunazzopardi.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-18T22:44:26.000Z","updated_at":"2024-07-23T08:05:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"d397ea0e-d39d-4b40-b3fb-36c911d2c675","html_url":"https://github.com/shaunazzopardi/solidity-cfg-builder","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaunazzopardi%2Fsolidity-cfg-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaunazzopardi%2Fsolidity-cfg-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaunazzopardi%2Fsolidity-cfg-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaunazzopardi%2Fsolidity-cfg-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shaunazzopardi","download_url":"https://codeload.github.com/shaunazzopardi/solidity-cfg-builder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248225664,"owners_count":21068078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["control-flow-graph","ethereum-verificaton","solidity","solidity-analysis","solidity-contracts","solidity-language","static-analysis"],"created_at":"2024-09-25T00:34:57.531Z","updated_at":"2025-04-10T13:23:02.581Z","avatar_url":"https://github.com/shaunazzopardi.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# solidity-cfg-builder\nA control-flow graph builder for Solidity smart contracts.\n\n## Overview\n\nThis package generates a control-flow graph from Solidity contracts. Control-flow graphs are helpful as a graphic representation of the semantics of programs, and are the basis of many static analysis approaches to optimizing and verifying programs. This package is the basis of a static analysis approach I am currently developing. \n\nsolidity-cfg-builder is developed in Haskell, utilising a Solidity syntax parser used in the runtime verification tool for Solidity [contractLarva](https://github.com/gordonpace/contractLarva). The version of the parser used in the project is packaged in the project. \n\nThis tool given Solidity code generates a control-flow graph in DOT notation, which can be visualised using [GraphViz](https://www.graphviz.org/).\n\n## Building the tool\n\nRequirements: [cabal v2.4.\\*](https://www.haskell.org/cabal/) (e.g. install the full [Haskell Platform](https://www.haskell.org/platform/))\n\nCompilation: Follow the instructions [here](https://cabal.readthedocs.io/en/latest/nix-local-build.html)\n\n## Tool usage:\n\nFor correct results always make sure that the Solidity code compiles with a Solidity compiler.\n\nTo use the tool pass the location of a solidity file and the preferred location of the output to the executable, e.g. execute:\n\n\u003e \"./solidity-cfg-builder\" \u0026lt;solidity-code.sol\u0026gt; \u0026lt;cfg.gv\u0026gt;\n\n## License\nThis project is licensed under the terms of the [Apache 2.0 license](LICENSE).\n\n## TODO (See Issues for an up-to-date list)\n1. \u003cs\u003eHandle function modifiers\u003c/s\u003e\n2. Allow option to flatten CFGs with function calls (consider also contract inheritance)\n3. Handle block of statements at end of function definition\n4. Event triggering is being parsed as a function call. Post-process to show triggerring of event explicitly.\n----\n# FAQ and Common Problems\n\n### When compiling the code I get the error: Could not find module ‘Text.Parsec’.\nMake sure you have installed parsec.  Also, see this stackoverflow thread (https://stackoverflow.com/questions/9058914/cant-find-parsec-modules-in-ghci)\n\u003ecabal install parsec\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaunazzopardi%2Fsolidity-cfg-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshaunazzopardi%2Fsolidity-cfg-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaunazzopardi%2Fsolidity-cfg-builder/lists"}