# Smart Contract Auditor (`davidcondrey/wl-contract-auditor`) Actor

Solidity vulnerability analysis (reentrancy, overflow, access control, logic bugs) with a severity-ranked JSON report.

- **URL**: https://apify.com/davidcondrey/wl-contract-auditor.md
- **Developed by:** [WritersLogic](https://apify.com/davidcondrey) (community)
- **Categories:** AI, Agents, Developer tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1,250.00 / 1,000 smart contract auditor runs

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Smart Contract Auditor

Source-level security review of Solidity: pass/warn/fail verdict, 0-100 risk score, severity-ranked findings with exact file:line, exploit scenario and a fix, plus a SARIF 2.1.0 log. Accepts raw code, a list of files, or an on-chain address (verified source is read from Sourcify). A deterministic detector pass (reentrancy ordering, tx.origin, delegatecall, unchecked calls, weak randomness, pre-0.8 arithmetic) runs beside one model review, and every model finding is checked against the source: its quoted snippet must exist and its line is corrected. A pre-audit triage, not a substitute for a manual audit; it cannot see deployed bytecode, off-chain components or economic assumptions, and not_checked lists what was missing.

Every result is a **signed, verifiable answer**:

- a W3C Verifiable Credential 2.0, signed with `eddsa-jcs-2022` by `did:web:agents.writerslogic.com`;
- a C2PA-style manifest that lists every source the agent read, each with its SHA-256;
- an EIP-191 co-signature over the same digest.

Change one byte and verification fails, so you can pass the result to a client, an auditor or another agent and they can check it without trusting you or us.

### How to use Smart Contract Auditor

1. Fill in the input form. Required fields are marked; the form opens with a working example.
2. Start the run.
3. Read the result in the **Output** tab, or download the dataset as JSON. The full signed envelope is also saved as the `OUTPUT` record in the key-value store.

### Input

| Field | Required | Description |
|---|---|---|
| `code` | no | Raw Solidity source (one or more files concatenated). Provide exactly one of code, files or address. |
| `contractName` | no | Contract to focus on when several are present. |
| `files` | no | Alternative to code: Solidity files with repository-relative paths. Findings report the file and line, and the SARIF log points at them. |
| `address` | no | Alternative to code: an on-chain contract address. Its verified source is read from Sourcify (no API key); unverified contracts return 404. |
| `chainId` | no | EVM chain id for address; default 1 (Ethereum mainnet). |

Example input:

```json
{
  "code": "pragma solidity ^0.8.20;\ncontract Vault {\n  mapping(address => uint256) public balances;\n  function deposit() external payable { balances[msg.sender] += msg.value; }\n  function withdraw() external {\n    (bool ok, ) = msg.sender.call{value: balances[msg.sender]}(\"\");\n    require(ok);\n    balances[msg.sender] = 0;\n  }\n}",
  "contractName": "Vault"
}
```

### Output

```json
{
  "agent": "contract-auditor",
  "priceUsd": 1.25,
  "data": { "...": "the agent's answer" },
  "_provenance": { "credential": {}, "manifest": {}, "ethSignature": "0x..." }
}
```

To check a result for free, POST `{ "data": ..., "_provenance": ... }` to `https://agents.writerslogic.com/api/v1/verify-provenance`, or verify it offline against the public key in the [DID document](https://agents.writerslogic.com/.well-known/did.json).

### Pricing

**$1.25 per successful run**, charged once and only after the agent returns its answer. If the input is rejected or the agent fails, you are not charged for the call.

### Use it from code or an AI assistant

- Apify API and integrations: call this Actor from Make, Zapier, n8n, LangChain or the Apify API like any other Actor.
- MCP: `npx -y @writerslogic/ai-agents-mcp` exposes this agent and the rest of the hub as tools.
- x402: the same agent is available at `POST https://agents.writerslogic.com/api/v1/audit-contract`, paid per call in USDC on Base.

### More verifiable agents

- [On-Chain Bytecode & Unverified Token Trap Detector](https://apify.com/davidcondrey/wl-token-trap-detector)
- [PR / Dependency Breaking-Change & Exploit Gatekeeper](https://apify.com/davidcondrey/wl-diff-gatekeeper)
- [Legal citation and quotation verifier (US case law)](https://apify.com/davidcondrey/wl-legal-cite-verifier)
- [Grant Milestone Verifier with Signed Release Attestation](https://apify.com/davidcondrey/wl-milestone-verifier)
- [DeFi Cover Claim Adjudicator](https://apify.com/davidcondrey/wl-cover-claim)
- [Vault Exit Lawyer](https://apify.com/davidcondrey/wl-vault-exit-lawyer)
- [All agents in one Actor](https://apify.com/davidcondrey/verifiable-ai-agents)

### FAQ

**Who runs this?** [WritersLogic](https://writerslogic.com/agents). The agent runs on the WritersLogic Verifiable AI Agent Hub; this Actor sends your input there and returns the signed result.

**Is my input stored?** The Actor stores your result in your own Apify storage. Ask before sending confidential documents; the hub is a third-party service from your point of view.

# Actor input Schema

## `code` (type: `string`):

Raw Solidity source (one or more files concatenated). Provide exactly one of code, files or address.

## `contractName` (type: `string`):

Contract to focus on when several are present.

## `files` (type: `array`):

Alternative to code: Solidity files with repository-relative paths. Findings report the file and line, and the SARIF log points at them.

## `address` (type: `string`):

Alternative to code: an on-chain contract address. Its verified source is read from Sourcify (no API key); unverified contracts return 404.

## `chainId` (type: `integer`):

EVM chain id for address; default 1 (Ethereum mainnet).

## Actor input object example

```json
{
  "code": "pragma solidity ^0.8.20;\ncontract Vault {\n  mapping(address => uint256) public balances;\n  function deposit() external payable { balances[msg.sender] += msg.value; }\n  function withdraw() external {\n    (bool ok, ) = msg.sender.call{value: balances[msg.sender]}(\"\");\n    require(ok);\n    balances[msg.sender] = 0;\n  }\n}",
  "contractName": "Vault"
}
```

# Actor output Schema

## `results` (type: `string`):

One dataset item per call: the agent id, the price charged, the agent's result (data) and its signed provenance record (\_provenance).

## `credential` (type: `string`):

The full hub response as a W3C Verifiable Credential with a C2PA-style manifest; verify it at https://agents.writerslogic.com/api/v1/verify-provenance.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "code": `pragma solidity ^0.8.20;
contract Vault {
  mapping(address => uint256) public balances;
  function deposit() external payable { balances[msg.sender] += msg.value; }
  function withdraw() external {
    (bool ok, ) = msg.sender.call{value: balances[msg.sender]}("");
    require(ok);
    balances[msg.sender] = 0;
  }
}`,
    "contractName": "Vault"
};

// Run the Actor and wait for it to finish
const run = await client.actor("davidcondrey/wl-contract-auditor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "code": """pragma solidity ^0.8.20;
contract Vault {
  mapping(address => uint256) public balances;
  function deposit() external payable { balances[msg.sender] += msg.value; }
  function withdraw() external {
    (bool ok, ) = msg.sender.call{value: balances[msg.sender]}(\"\");
    require(ok);
    balances[msg.sender] = 0;
  }
}""",
    "contractName": "Vault",
}

# Run the Actor and wait for it to finish
run = client.actor("davidcondrey/wl-contract-auditor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "code": "pragma solidity ^0.8.20;\\ncontract Vault {\\n  mapping(address => uint256) public balances;\\n  function deposit() external payable { balances[msg.sender] += msg.value; }\\n  function withdraw() external {\\n    (bool ok, ) = msg.sender.call{value: balances[msg.sender]}(\\"\\");\\n    require(ok);\\n    balances[msg.sender] = 0;\\n  }\\n}",
  "contractName": "Vault"
}' |
apify call davidcondrey/wl-contract-auditor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,davidcondrey/wl-contract-auditor"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/NY8wTb8580dGLuUOK/builds/uzefgmdfgzh6uzwyE/openapi.json
