{"id":15797276,"url":"https://github.com/taka-security/sslc","last_synced_at":"2025-09-14T07:01:54.916Z","repository":{"id":44219910,"uuid":"178895419","full_name":"Taka-Security/sslc","owner":"Taka-Security","description":"cli tool to check Solidity storage memory layout of structs for inefficiencies","archived":false,"fork":false,"pushed_at":"2022-12-30T17:24:11.000Z","size":191,"stargazers_count":8,"open_issues_count":6,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-31T23:28:01.866Z","etag":null,"topics":["checker","cli","ethereum","layout","memory","solidity","storage","struct"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Taka-Security.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-01T15:43:43.000Z","updated_at":"2025-08-27T12:19:44.000Z","dependencies_parsed_at":"2023-01-31T12:16:22.890Z","dependency_job_id":null,"html_url":"https://github.com/Taka-Security/sslc","commit_stats":null,"previous_names":["rmi7/sslc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Taka-Security/sslc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taka-Security%2Fsslc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taka-Security%2Fsslc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taka-Security%2Fsslc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taka-Security%2Fsslc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Taka-Security","download_url":"https://codeload.github.com/Taka-Security/sslc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taka-Security%2Fsslc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273708459,"owners_count":25153726,"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","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["checker","cli","ethereum","layout","memory","solidity","storage","struct"],"created_at":"2024-10-05T00:06:05.945Z","updated_at":"2025-09-05T03:36:57.351Z","avatar_url":"https://github.com/Taka-Security.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **S**olidity **S**torage **L**ayout **C**hecker\n\n![License](https://img.shields.io/github/license/rmi7/sslc.svg?style=flat-square)\n[![Version](https://img.shields.io/npm/v/sslc.svg?style=flat-square\u0026label=version)](https://www.npmjs.com/package/sslc)\n![Download](https://img.shields.io/npm/dt/sslc.svg)\n\nGiven some Solidity smart contract(s), extract all structs and check if their members could be laid out more efficient (=occupy less storage slots).\n\n#### Timeout\n\nIf the number of struct members is sufficiently high, the algorithm to find the most efficient layout \nwill run \"indefinitely\". To guard against this, there is a default 10 second timeout to calculate \nthe most efficient layout of any given struct. If the timeout is exceeded the calculation will exit and \ngive the \"current best slot count\" as well as info that the timeout was reached. This timeout can be \ncustomized using the `-t \u003csecs\u003e` argument.\n\n## Dependencies\n\nMakes use of [solidity-parser-antlr](https://github.com/federicobond/solidity-parser-antlr) to parse Solidity files.\n\n## Usage\n\n```\nusage: sslc [-h] [-v] -f path [path ...] [-oj path] [-ot path]\n\nSolidity storage layout checker\n\nOptional arguments:\n  -h, --help          Show this help message and exit.\n  -v, --version       Show program's version number and exit.\n  -f path [path ...]  input solidity file(s), supports glob\n  -oj path            write output to JSON file\n  -ot path            write output to text file\n  -t secs             brute force timeout, default 10s\n```\n\n#### without install\n\n```\nnpx sslc -f ~/my-solidity-project/contracts/*.sol\n```\n\n#### with install\n\n```\nnpm i -g sslc\nsslc -f ~/my-solidity-project/contracts/*.sol\n```\n\n## Output\n\nThe script will print text output using Solidity syntax to stdout. \nIt is also possible to save the text output to a file and/or save JSON output to a file.\n\n#### Text output\n\n```Solidity\nstruct MyFirstStruct { // file: SomeContract.sol | contract: SomeContract\n\n  uint8 myFirstVar; // bytes: 1\n  //---------- end of slot | bytes taken: 1 | bytes free: 31\n  \n  bytes32[] mySecondVar; // bytes: 32\n  //---------- end of slot | bytes taken: 32 | bytes free: 0\n  \n  bool myThirdVar; // bytes: 1\n  //---------- end of slot | bytes taken: 1 | bytes free: 31\n  \n  uint256 myFourthVar; // bytes: 32\n  //---------- end of slot | bytes taken: 32 | bytes free: 0\n  \n  bool myFourthVar; // bytes: 1\n  //---------- end of slot | bytes taken: 1 | bytes free: 31\n \n} // slots that can be saved = 2\n\nstruct MyParentStruct { // file: SomeOtherContract.sol | contract: ParentContract\n\n  uint8 myFirstVar; // bytes: 1\n  //---------- end of slot | bytes taken: 1 | bytes free: 31\n  \n  uint256 mySecondVar; // bytes: 32\n  //---------- end of slot | bytes taken: 32 | bytes free: 0\n  \n  uint16 myThirdVar; // bytes: 2\n  //---------- end of slot | bytes taken: 2 | bytes free: 30\n  \n} // slots that can be saved = 1\n\nstruct MyOtherStruct { // file: SomeOtherContract.sol | contract: SomeOtherContract\n\n  uint256 myFirstVar; // bytes: 32\n  //---------- end of slot | bytes taken: 32 | bytes free: 0\n  \n  address mySecondVar; // bytes: 20\n  //---------- end of slot | bytes taken: 20 | bytes free: 12\n \n} // slots that can be saved = 0\n\n// STRUCTS THAT CAN BE OPTIMIZED\n// =============================\n// file: SomeContract.sol\n// contract: SomeContract\n// struct: MyFirstStruct\n// slots saved: 2\n// -----------------------------\n// file: SomeOtherContract.sol\n// contract: ParentContract\n// struct: MyParentStruct\n// slots saved: 1\n// -----------------------------\n```\n\n#### JSON output\n\n```json\n[\n    {\n        \"file\": \"SomeContract.sol\",\n        \"contract\": \"SomeContract\",\n        \"struct\": \"MyFirstStruct\",\n        \"slotsSaved\": 2,\n        \"timedout\": false\n    },\n    {\n        \"file\": \"SomeOtherContract.sol\",\n        \"contract\": \"ParentContract\",\n        \"struct\": \"MyParentStruct\",\n        \"slotsSaved\": 1,\n        \"timedout\": false\n    }\n]\n```\n\n## Test\n\n`npm test`\n\n## TODO\n\n- do the same for the layout of variables of a given contract\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaka-security%2Fsslc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaka-security%2Fsslc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaka-security%2Fsslc/lists"}