This app runs inside the BotSurf browser. Don't have it yet? Get the app or extension now!

Constant vs Immutable Usage Auditor

Developer Tools · All
0 installs · Verified BotGentz app
Launch App
Opens in BotSurf — nothing to install.
CategoryDeveloper Tools
PlatformAll
Pricing Free
Installs0
Download BotSurf to use — free
No account needed for free apps. Once BotSurf is open, find this app in Apps from the + menu.

About this app

WHAT IT DOES

Constant vs Immutable Usage Auditor is a developer-focused tool that audits Solidity contracts for constant and immutable usage, identifying variables that can be optimized for gas savings and security. It takes contract source code from the user and parses all variable declarations, detecting constants, immutables, and regular variables. The tool analyzes each variable to determine if it could be declared as constant (compile-time known value) or immutable (set once in constructor). It provides suggestions for converting regular variables to constant or immutable where appropriate, with clear reasoning and severity levels. Results are displayed with a summary showing the count of constants, immutables, regular variables, and potential optimizations. Each suggestion includes the variable name, current type, proposed change, reasoning, and line number. This enables developers to reduce gas costs by using the most appropriate variable type for each use case.

HOW TO USE

Paste your Solidity contract source code into the input area. Click "Audit constant/immutable usage" to analyze the code. The tool will display a summary showing the total number of variables, constants, immutables, regular variables, and potential optimizations. Each suggestion entry includes the variable name, current type, the suggested change, reasoning, and line number. The audit report can be copied or downloaded as JSON for further analysis.

TECHNICAL NOTE: CONSTANT AND IMMUTABLE DETECTION

The tool uses regex-based parsing to extract variable declarations from Solidity source code. It identifies variables declared with the `constant` and `immutable` keywords, and analyzes regular variables for optimization potential. A variable is flagged as a potential constant if it is assigned a compile-time constant value (e.g., a literal or expression that can be evaluated at compile time). A variable is flagged as a potential immutable if it is assigned in the constructor or is a public variable set once. The tool also checks for assignment patterns and usage context to provide accurate recommendations. Each recommendation is classified by severity: optimize (definite gas savings), warn (potential improvement), or info (informational).

WHAT IT CANNOT SEE

The tool cannot automatically detect all use cases without context; some variables may appear to be constant/immutable but may be modified in ways not apparent from static analysis. It is limited to the accuracy of the source code analysis; syntax variations may cause parsing issues. It cannot detect issues in external contracts or libraries that are imported into the contract. It is limited by the parser's ability to handle Solidity syntax variations, including newer language features. It cannot audit for non-EVM chains.

PLEASE NOTE

This tool is designed exclusively for Solidity contracts on EVM-compatible chains. It does not support other smart contract languages. The suggestions are based on static analysis and should be verified with actual usage patterns and testing. The tool is read-only and does not modify any state. The tool provides no warranty that the suggestions are complete or accurate; users are responsible for validating all recommendations.

Similar Apps

Log in to BotGentz

Suggest an App

Tell us what you'd find useful — if we build it, we'll email you the moment it's ready.