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

Pre/Post-Condition Annotator for Functions

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

This tool generates formal pre-condition and post-condition annotations for smart contract functions, providing a rigorous foundation for formal verification, security audits, and test case generation. By analyzing verified source code, function signatures, storage variables, and on-chain state, it produces structured annotations that capture the expected behavior of each function—including input validation requirements, state invariants, access controls, and output properties. Each annotation includes natural language descriptions and formal logical formulas (e.g., "balanceOf(msg.sender) >= amount" for pre-conditions, "balanceOf(recipient) == old(balanceOf(recipient)) + amount" for post-conditions). The generator supports filtering by specific function names, making it adaptable for large contracts with many functions. This is essential for developers implementing formal verification pipelines, auditors documenting security properties, and teams establishing correctness guarantees for critical smart contracts.

HOW TO USE

Connect your wallet (read-only, no transaction required) and select the target network. Enter the contract name and address, and optionally specify a comma-separated list of function names to focus on specific functions. Click "annotate conditions" and the tool will verify the contract, fetch source code and ABI data, and generate pre/post-condition annotations for each function. Results display a summary of the contract, a series of annotation cards showing each function's signature, pre-conditions, and post-conditions, and a detailed table of all annotations. Use the annotations as a starting point for formal verification with tools like Certora, Foundry, or Echidna, or integrate them into your test suite as property-based tests.

TECHNICAL MECHANISM

The generator uses ethers.js v5.7.2 to perform a multi-stage annotation process. First, it calls eth_getCode to verify the contract is deployed. It then uses block explorer APIs (Etherscan) to fetch verified source code and ABI, parsing function signatures, parameter types, and storage variable definitions. For each function, the tool applies a curated library of common condition patterns based on the contract type and function name. For standard functions like transfer, approve, and transferFrom, it generates pre-conditions (e.g., non-zero address checks, balance sufficiency, allowance sufficiency) and post-conditions (e.g., balance updates, allowance decrements, return values). For custom functions, it infers conditions from storage variable names and types, generating generic pre-conditions (parameter validation) and post-conditions (state variable updates). The tool also analyzes current contract state via eth_call to infer reasonable bounds and validation conditions. Each condition is expressed in a readable formal notation that can be directly used in verification tools or translated to Solidity require/assert statements.

WHAT IT CANNOT SEE

This tool cannot generate conditions for contracts that are not verified on a block explorer, as source code and ABI are required for accurate function analysis. It is limited by the RPC provider's rate limits and block range availability for historical log queries. It cannot infer conditions that depend on off-chain state, cross-chain data, or complex external dependencies such as oracle price feeds or randomness. The generated annotations are simplified representations and may not capture all possible pre/post conditions, edge cases, or error states—they serve as a starting point for further refinement. It cannot guarantee that generated conditions are complete or sufficient for formal verification; manual review and validation are always required. The tool relies on the accuracy and completeness of source code verification and ABI data; contracts with complex inheritance patterns, proxy patterns, or opaque logic may produce incomplete or inaccurate annotations. It cannot detect conditions that require external oracle data or complex input validation that is not captured in the source code.

PLEASE NOTE

This is a read‑only analytics tool—it never submits transactions or signs anything. It is designed for EVM‑compatible chains and works best with verified contracts that follow standard DeFi patterns. The generated annotations are for development and audit purposes only and should not be considered a guarantee of contract correctness. Always review, validate, and refine generated annotations before using them in formal verification or security audits. For complex functions, consider combining generated annotations with manual specification writing and testing.

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.