# SC Audit

> AI smart contract security auditor. Deep security audit of a smart-contract repo OR a live on-chain contract by address - detect Solidity, model the protocol invariants and trust boundaries first, run Slither (best-effort) plus a bounded agentic pass that hunts for a path breaking each invariant, triage, adversarially verify, prove with a fuzzer, and drive each finding through the shared responsible-disclosure routing. The dedicated contract arm split out of vuln-scanner.

- Skill: `sc-audit`
- Category: Dev & Code (https://www.aeon.fun/skills#dev)
- Default schedule: On demand
- Last updated: 2026-11-05 (commit 504a21d)
- Source: https://github.com/aeonfun/aeon/blob/main/skills/sc-audit/SKILL.md

## What it does

Smart-contract bugs are logic and economics, not syntax. Slither matches known static patterns; it is weak on **access control, protocol invariants, oracle/price manipulation, rounding/precision, upgradeability storage collisions, and cross-contract reentrancy** - the classes that actually drain funds, and where exploitation on-chain is immediate and irreversible. That whole class is what an agentic reviewer catches by reading the source and reasoning about who can call what and which invariant breaks.

This skill is the **contract arm split out of `vuln-scanner`**. vuln-scanner detects Solidity and hands the repo here rather than running Slither inline; this skill owns the deep audit and then routes findings through vuln-scanner's shared disclosure machinery. It does **not** duplicate the disclosure/PVR/email logic - see §S7.

It audits two kinds of target: a **GitHub repo** (source in a repo you fork), and a **live contract deployed on-chain by address** (`<chain>:0x<addr>`) - the latter fetches the verified source from the block explorer/Sourcify and adds on-chain context (proxy/implementation, owner, funds at risk). A live deployed contract is where a bug is *already exploitable with real money at stake*, so on-chain findings are treated as the highest-stakes disclosure and are **operator-gated** - staged for a human, never auto-filed (§S7).

The agentic source pass is the **reliable core**. Slither is best-effort: a headless run has `slither` allow-listed but **not** `solc` / `forge` / `solc-select`, so contracts that need a compiler to build may not compile in-run. The source pass needs no compiler, so a clean audit never depends on Slither succeeding.

## Input: the var setting

Target selector. Four forms:
- *empty* (empty) -> auto-select the day's fresh feed target, audit **only if it contains Solidity**, else exit clean. See §S1 for the selection order (an optional `sc-targets.json` ledger, else the `github-trending` feed).
- `owner/repo` -> audit that GitHub repo (e.g. `Uniswap/v4-core`, `aave/aave-v3-origin`).
- `<chain>:0x<address>` -> **on-chain mode**: audit a **live deployed contract by address**. It fetches the verified source from the block explorer (Etherscan V2) or Sourcify, materializes it as a Foundry project, and runs the same pipeline - plus on-chain context (proxy/implementation, owner/admin, funds at risk). `chain` in `eth`/`base`/`arbitrum`/`optimism`/`polygon`/`bsc`/... (bare `0x<address>` defaults to `eth`). Examples: `base:0x4200000000000000000000000000000000000006`, `eth:0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`. On-chain findings are **operator-gated** - never auto-filed/auto-emailed (see §S7). See §S1/§S2.
- `fixture:<name>` -> **local regression mode**: audit the bundled fixture at `skills/sc-audit/fixtures/<name>/` (e.g. `fixture:vault`). No fork, no dedup, no disclosure - a self-contained way to exercise the whole pipeline including the fuzz arm, with no external repo. See §S1/§S2.

## What it needs

- `GH_GLOBAL`: optional secret
- `ETHERSCAN_API_KEY`: optional secret
- `BLOCKSCOUT_API_KEY`: optional secret
- `RESEND_API_KEY`: optional secret
- `RESEND_FROM`: optional secret
- `RESEND_REPLY_TO`: optional secret

## Install

```bash
bin/add-skill aeonfun/aeon sc-audit
```

```yaml
skills:
  sc-audit: { enabled: true, schedule: "workflow_dispatch", var: "" }
```

## Related skills

- [SEO Audit](https://www.aeon.fun/skills/seo-audit): Daily on-page and technical SEO audit of every page on a site - discovers URLs from the sitemap, scores each page, adds cross-page checks (duplicate titles, canonicals, sitemap gaps), diffs against yesterday, and sends the score line plus any regressions
- [RightStack - Web3 Stack Advisor](https://www.aeon.fun/skills/rightstack): Use RightStack as a read-only Web3 stack advisor for architecture recommendations, workflow inspection, tool comparisons, and package-migration checks
- [Spend Watch](https://www.aeon.fun/skills/spend-watch): Autonomous cloud-cost analyst across Neon, Vercel, Railway and GitHub Actions - pulls per-object usage, attributes it to the biggest drivers, root-causes each, and emits recommendations ranked by real signal (idle %, over-allowance, failure rate) with dollar figures only where the billing API returns real ones (and, armed, applies safe cost levers)
- [PR Triage](https://www.aeon.fun/skills/pr-triage): First-touch triage for external pull requests - verdict, label, and a welcoming comment within minutes of open
- [Vuln Scanner](https://www.aeon.fun/skills/vuln-scanner): Audit trending repos for real security vulnerabilities and disclose responsibly - scan and route findings (PVR / dependency PR), re-submit queued advisories, and send armed email disclosures
- [PostHog Error Digest](https://www.aeon.fun/skills/posthog-errors): Weekly cross-project error overview from PostHog - enumerates every project the OAuth grant covers, pulls the last 7 days of error-tracking issues per project, ranks them by impact, flags what's new vs ongoing, and sends one digest with per-project totals, the top issues, and a clickable link to a full committed report of every issue
