Skip to main content

Code Analysis

Searches verified contract source code using AI-generated regex patterns.

Capabilities

  • Search by natural language query
  • Find functions, patterns, or behaviors
  • Return filtered results or full code

Example Queries

Parameters

Usage Patterns

Finding Functions

Access Control

Searches for: onlyOwner modifiers, role-based patterns, admin state variables

Security Patterns

Finds: pause/unpause functions, emergency stops, circuit breakers

Practical Examples

Example 1: Finding Fee Logic

You: “Show me how fees are calculated in the Uniswap V3 swap function” Result:

Example 2: Checking for Dangerous Patterns

You: “Does this contract have any selfdestruct or delegatecall?” Result:

Example 3: Understanding State Variables

You: “What are the main state variables in this contract?” Result:

Full Code Retrieval

Use returnAllCode: true to get complete source code for:
  • Full code review
  • Context around matches
  • Cross-function patterns
Search across multiple contracts simultaneously:

Tips

Be specific: “find the withdraw function” beats “find withdrawal logic”
Search by behavior: “functions that can move user funds” captures more than “find transfer”

Common Search Queries

Limitations

Only works on verified contracts. Unverified contracts don’t have source code available.
Large contracts may be truncated. Very large codebases might not return complete results in a single query.

Combining with Other Tools

  1. Get overview firstcontractMetadataTool
  2. Search specific coderegexCodeAnalysisTool
  3. Check how it’s usedgetLatestTransactionsTool

Next Steps

Contract Metadata

Get contract overview first

Version Diffs

Compare contract versions