{"id":"contract-auditor","title":"Smart Contract Auditor","description":"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.","roi":"A pre-audit triage pass catches the obvious reentrancy and access-control bugs before a manual audit, so paid auditor hours go to the hard problems. Not a replacement for that audit.","audience":"crypto","channels":["x402","mcp","rapidapi"],"endpoint":{"method":"POST","url":"https://agents.writerslogic.com/api/v1/audit-contract","path":"/api/v1/audit-contract","contentType":"application/json"},"price":{"amount":"1.00","currency":"USDC","network":"base","perCall":true,"failedCallsCharged":false},"inputSchema":{"type":"object","additionalProperties":false,"properties":{"code":{"type":"string","minLength":1,"maxLength":100000,"description":"Raw Solidity source (one or more files concatenated). Provide exactly one of code, files or address."},"contractName":{"type":"string","maxLength":200,"description":"Contract to focus on when several are present."},"files":{"type":"array","maxItems":40,"description":"Alternative to code: Solidity files with repository-relative paths. Findings report the file and line, and the SARIF log points at them.","items":{"type":"object","additionalProperties":false,"required":["path","content"],"properties":{"path":{"type":"string","minLength":1,"maxLength":300},"content":{"type":"string","maxLength":100000}}}},"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"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","minimum":1,"maximum":2147483647,"description":"EVM chain id for address; default 1 (Ethereum mainnet)."}}},"resultSchema":{"type":"object","additionalProperties":false,"required":["summary","overall_risk","findings","verdict","verdict_reason","risk_score","status","next_step","top_findings","source","sarif","contract_names","compiler_version","not_checked","severity_counts","lines_of_code"],"properties":{"summary":{"type":"string"},"overall_risk":{"type":"string","enum":["critical","high","medium","low","informational","none"]},"findings":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","title","severity","category","location","code_snippet","description","exploit_scenario","recommendation","confidence","source","verification","line_start","line_end","file","line","end_line"],"properties":{"id":{"type":"string","description":"Sequential id such as F-01."},"title":{"type":"string"},"severity":{"type":"string","enum":["critical","high","medium","low","informational"]},"category":{"type":"string","enum":["reentrancy","integer_overflow_underflow","access_control","logic_error","unchecked_external_call","oracle_price_manipulation","front_running_mev","denial_of_service","timestamp_dependence","tx_origin_auth","delegatecall_proxy","storage_collision_uninitialized","signature_replay","erc_standard_violation","centralization_risk","gas_optimization","other"]},"location":{"type":"string","description":"Contract.function and line number(s) from the numbered source."},"code_snippet":{"type":"string","description":"The exact source text of the vulnerable statement, copied verbatim without the line-number prefix."},"description":{"type":"string"},"exploit_scenario":{"type":"string","description":"Concrete attacker steps, or \"n/a\" for non-exploitable issues."},"recommendation":{"type":"string","description":"Specific fix, with a short code snippet when useful."},"confidence":{"type":"string","enum":["high","medium","low"]},"source":{"type":"string","enum":["model","static"],"description":"static = raised by the deterministic detector pass."},"verification":{"type":"string","enum":["verified","line_corrected","snippet_not_found","static_detector"],"description":"snippet_not_found lowers confidence to low."},"line_start":{"type":"integer","description":"True 1-based line of the snippet in the combined source the model read; 0 when it could not be located."},"line_end":{"type":"integer"},"file":{"type":"string","description":"File holding the finding; contract.sol for code input, the Sourcify or uploaded path otherwise."},"line":{"type":"integer","description":"1-based line within file (1 when the snippet could not be located)."},"end_line":{"type":"integer"}}}},"verdict":{"type":"string","enum":["fail","warn","pass","inconclusive"],"description":"fail: a critical or high finding of medium or high confidence. warn: other findings. pass: only informational notes or none (not proof of safety). inconclusive: no findings but part of the source was not reviewed."},"verdict_reason":{"type":"string"},"risk_score":{"type":"integer","description":"0-100, computed in code from finding severity and confidence."},"status":{"type":"string","enum":["complete","partial"],"description":"partial when files were left out of the review; the result is still signed and not_checked says what is missing."},"next_step":{"type":"string"},"top_findings":{"type":"array","items":{"type":"object","description":"Up to 5 non-informational findings: id, title, severity, confidence, file, line, fix."}},"source":{"type":"object","description":"Where the source came from: kind (code, files, sourcify), file paths reviewed, and for Sourcify the address, chainId, match type, compiler and verification time."},"sarif":{"type":"object","description":"SARIF 2.1.0 log, one result per finding at its file and line; uploads to GitHub code scanning as-is."},"contract_names":{"type":"array","items":{"type":"string"},"description":"Parsed from the source, not model-generated."},"compiler_version":{"type":"string","description":"Parsed pragma expression, or \"unspecified\"."},"not_checked":{"type":"array","items":{"type":"string"},"description":"What this review could not see; an empty findings list does not cover these."},"severity_counts":{"type":"object","additionalProperties":false,"required":["critical","high","medium","low","informational"],"properties":{"critical":{"type":"integer"},"high":{"type":"integer"},"medium":{"type":"integer"},"low":{"type":"integer"},"informational":{"type":"integer"}}},"lines_of_code":{"type":"integer"}}},"outputSchema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":false,"required":["summary","overall_risk","findings","verdict","verdict_reason","risk_score","status","next_step","top_findings","source","sarif","contract_names","compiler_version","not_checked","severity_counts","lines_of_code"],"properties":{"summary":{"type":"string"},"overall_risk":{"type":"string","enum":["critical","high","medium","low","informational","none"]},"findings":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","title","severity","category","location","code_snippet","description","exploit_scenario","recommendation","confidence","source","verification","line_start","line_end","file","line","end_line"],"properties":{"id":{"type":"string","description":"Sequential id such as F-01."},"title":{"type":"string"},"severity":{"type":"string","enum":["critical","high","medium","low","informational"]},"category":{"type":"string","enum":["reentrancy","integer_overflow_underflow","access_control","logic_error","unchecked_external_call","oracle_price_manipulation","front_running_mev","denial_of_service","timestamp_dependence","tx_origin_auth","delegatecall_proxy","storage_collision_uninitialized","signature_replay","erc_standard_violation","centralization_risk","gas_optimization","other"]},"location":{"type":"string","description":"Contract.function and line number(s) from the numbered source."},"code_snippet":{"type":"string","description":"The exact source text of the vulnerable statement, copied verbatim without the line-number prefix."},"description":{"type":"string"},"exploit_scenario":{"type":"string","description":"Concrete attacker steps, or \"n/a\" for non-exploitable issues."},"recommendation":{"type":"string","description":"Specific fix, with a short code snippet when useful."},"confidence":{"type":"string","enum":["high","medium","low"]},"source":{"type":"string","enum":["model","static"],"description":"static = raised by the deterministic detector pass."},"verification":{"type":"string","enum":["verified","line_corrected","snippet_not_found","static_detector"],"description":"snippet_not_found lowers confidence to low."},"line_start":{"type":"integer","description":"True 1-based line of the snippet in the combined source the model read; 0 when it could not be located."},"line_end":{"type":"integer"},"file":{"type":"string","description":"File holding the finding; contract.sol for code input, the Sourcify or uploaded path otherwise."},"line":{"type":"integer","description":"1-based line within file (1 when the snippet could not be located)."},"end_line":{"type":"integer"}}}},"verdict":{"type":"string","enum":["fail","warn","pass","inconclusive"],"description":"fail: a critical or high finding of medium or high confidence. warn: other findings. pass: only informational notes or none (not proof of safety). inconclusive: no findings but part of the source was not reviewed."},"verdict_reason":{"type":"string"},"risk_score":{"type":"integer","description":"0-100, computed in code from finding severity and confidence."},"status":{"type":"string","enum":["complete","partial"],"description":"partial when files were left out of the review; the result is still signed and not_checked says what is missing."},"next_step":{"type":"string"},"top_findings":{"type":"array","items":{"type":"object","description":"Up to 5 non-informational findings: id, title, severity, confidence, file, line, fix."}},"source":{"type":"object","description":"Where the source came from: kind (code, files, sourcify), file paths reviewed, and for Sourcify the address, chainId, match type, compiler and verification time."},"sarif":{"type":"object","description":"SARIF 2.1.0 log, one result per finding at its file and line; uploads to GitHub code scanning as-is."},"contract_names":{"type":"array","items":{"type":"string"},"description":"Parsed from the source, not model-generated."},"compiler_version":{"type":"string","description":"Parsed pragma expression, or \"unspecified\"."},"not_checked":{"type":"array","items":{"type":"string"},"description":"What this review could not see; an empty findings list does not cover these."},"severity_counts":{"type":"object","additionalProperties":false,"required":["critical","high","medium","low","informational"],"properties":{"critical":{"type":"integer"},"high":{"type":"integer"},"medium":{"type":"integer"},"low":{"type":"integer"},"informational":{"type":"integer"}}},"lines_of_code":{"type":"integer"}}},"_provenance":{"type":"object","description":"C2PA-aligned manifest and W3C VC 2.0 (eddsa-jcs-2022) issued by the hub DID; verify at POST /api/v1/verify-provenance"}},"required":["data","_provenance"]},"example":{"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"},"openapiOperation":{"operationId":"contract_auditor","summary":"Smart Contract Auditor","description":"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.\n\nPrice: 1.00 USDC on Base (x402).","x-x402-price-usdc":"1.00","x-x402-amount":"1000000","x-payment-info":{"protocols":["x402"],"price":{"mode":"fixed","currency":"USD","amount":"1.00"}},"x-audience":"crypto","x-sample-url":"https://agents.writerslogic.com/api/v1/samples/contract-auditor","security":[{"x402":[]},{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"code":{"type":"string","minLength":1,"maxLength":100000,"description":"Raw Solidity source (one or more files concatenated). Provide exactly one of code, files or address."},"contractName":{"type":"string","maxLength":200,"description":"Contract to focus on when several are present."},"files":{"type":"array","maxItems":40,"description":"Alternative to code: Solidity files with repository-relative paths. Findings report the file and line, and the SARIF log points at them.","items":{"type":"object","additionalProperties":false,"required":["path","content"],"properties":{"path":{"type":"string","minLength":1,"maxLength":300},"content":{"type":"string","maxLength":100000}}}},"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$","description":"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","minimum":1,"maximum":2147483647,"description":"EVM chain id for address; default 1 (Ethereum mainnet)."}}},"example":{"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"}}}},"responses":{"200":{"description":"Paid result with provenance","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":false,"required":["summary","overall_risk","findings","verdict","verdict_reason","risk_score","status","next_step","top_findings","source","sarif","contract_names","compiler_version","not_checked","severity_counts","lines_of_code"],"properties":{"summary":{"type":"string"},"overall_risk":{"type":"string","enum":["critical","high","medium","low","informational","none"]},"findings":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","title","severity","category","location","code_snippet","description","exploit_scenario","recommendation","confidence","source","verification","line_start","line_end","file","line","end_line"],"properties":{"id":{"type":"string","description":"Sequential id such as F-01."},"title":{"type":"string"},"severity":{"type":"string","enum":["critical","high","medium","low","informational"]},"category":{"type":"string","enum":["reentrancy","integer_overflow_underflow","access_control","logic_error","unchecked_external_call","oracle_price_manipulation","front_running_mev","denial_of_service","timestamp_dependence","tx_origin_auth","delegatecall_proxy","storage_collision_uninitialized","signature_replay","erc_standard_violation","centralization_risk","gas_optimization","other"]},"location":{"type":"string","description":"Contract.function and line number(s) from the numbered source."},"code_snippet":{"type":"string","description":"The exact source text of the vulnerable statement, copied verbatim without the line-number prefix."},"description":{"type":"string"},"exploit_scenario":{"type":"string","description":"Concrete attacker steps, or \"n/a\" for non-exploitable issues."},"recommendation":{"type":"string","description":"Specific fix, with a short code snippet when useful."},"confidence":{"type":"string","enum":["high","medium","low"]},"source":{"type":"string","enum":["model","static"],"description":"static = raised by the deterministic detector pass."},"verification":{"type":"string","enum":["verified","line_corrected","snippet_not_found","static_detector"],"description":"snippet_not_found lowers confidence to low."},"line_start":{"type":"integer","description":"True 1-based line of the snippet in the combined source the model read; 0 when it could not be located."},"line_end":{"type":"integer"},"file":{"type":"string","description":"File holding the finding; contract.sol for code input, the Sourcify or uploaded path otherwise."},"line":{"type":"integer","description":"1-based line within file (1 when the snippet could not be located)."},"end_line":{"type":"integer"}}}},"verdict":{"type":"string","enum":["fail","warn","pass","inconclusive"],"description":"fail: a critical or high finding of medium or high confidence. warn: other findings. pass: only informational notes or none (not proof of safety). inconclusive: no findings but part of the source was not reviewed."},"verdict_reason":{"type":"string"},"risk_score":{"type":"integer","description":"0-100, computed in code from finding severity and confidence."},"status":{"type":"string","enum":["complete","partial"],"description":"partial when files were left out of the review; the result is still signed and not_checked says what is missing."},"next_step":{"type":"string"},"top_findings":{"type":"array","items":{"type":"object","description":"Up to 5 non-informational findings: id, title, severity, confidence, file, line, fix."}},"source":{"type":"object","description":"Where the source came from: kind (code, files, sourcify), file paths reviewed, and for Sourcify the address, chainId, match type, compiler and verification time."},"sarif":{"type":"object","description":"SARIF 2.1.0 log, one result per finding at its file and line; uploads to GitHub code scanning as-is."},"contract_names":{"type":"array","items":{"type":"string"},"description":"Parsed from the source, not model-generated."},"compiler_version":{"type":"string","description":"Parsed pragma expression, or \"unspecified\"."},"not_checked":{"type":"array","items":{"type":"string"},"description":"What this review could not see; an empty findings list does not cover these."},"severity_counts":{"type":"object","additionalProperties":false,"required":["critical","high","medium","low","informational"],"properties":{"critical":{"type":"integer"},"high":{"type":"integer"},"medium":{"type":"integer"},"low":{"type":"integer"},"informational":{"type":"integer"}}},"lines_of_code":{"type":"integer"}}},"_provenance":{"type":"object","description":"C2PA-aligned manifest and W3C VC 2.0 (eddsa-jcs-2022) issued by the hub DID; verify at POST /api/v1/verify-provenance"}},"required":["data","_provenance"]}}}},"400":{"description":"Invalid request (no payment consumed)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}},"401":{"description":"Invalid X-API-KEY","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}},"402":{"description":"Payment required or invalid","content":{"application/json":{"schema":{"type":"object","description":"x402 v2 PaymentRequired (also base64 in the PAYMENT-REQUIRED header)","properties":{"x402Version":{"type":"integer"},"error":{"type":"string"},"code":{"type":"string"},"resource":{"type":"object"},"accepts":{"type":"array","items":{"type":"object"}},"extensions":{"type":"object"}}}}}},"502":{"description":"Upstream failure; the payment is released or not settled","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}}}},"links":{"docs":"https://agents.writerslogic.com/docs/contract-auditor/","docsJson":"https://agents.writerslogic.com/docs/contract-auditor.json","sample":"https://agents.writerslogic.com/api/v1/samples/contract-auditor","openapi":"https://agents.writerslogic.com/openapi.json","catalog":"https://agents.writerslogic.com/api/v1/catalog","verifyProvenance":"https://agents.writerslogic.com/api/v1/verify-provenance","index":"https://agents.writerslogic.com/docs/index.json"}}