# Dices launchpad: Trail of Bits and Uniswap skill review

**Date**: 25 November 2026
**Commit**: `bcd45b2` on `main`
**Scope**: `src/` (launchpad core), and `script/deployment/V001.s.sol` for deployment
**Reviewer**: Claude Code, running the skills listed below

This is an internal, tool-assisted review. It is not a substitute for an independent audit; the Uniswap skill's
own scoring puts this hook in the tier where a professional audit is required before mainnet.

## Result

The liquidity lock, the delta accounting, the escrow and the level oracle's arithmetic all held up under review
and testing. Nobody can remove the launch liquidity, take another user's coins or take credits from the escrow.

Twenty-two findings were confirmed: four Medium, four Low, one that cannot be rated without a client decision,
and thirteen informational. Eight further candidates were checked and rejected.

One of the Medium findings (DICES-05) lets an unprivileged caller come away with USDC. It needs a large buy to
have just happened, and the amount is bounded by that buy's queued fee: 470 USDC after a 30,000 USDC buy in the
measured case.

| ID | Severity | Finding |
| --- | --- | --- |
| DICES-01 | Medium | `createCoin` accepts a zero creator, after which that pool's sells and most buys revert for good |
| DICES-02 | Medium | Levels 9 and 10 need 3,800 and 5,800 holders of 300,000 coins; the supply allows 3,333 |
| DICES-03 | Medium | The owner can change the fee rate, the fee split and the level of existing pools with no cap or delay |
| DICES-05 | Medium | After one large buy, any caller can push the price down inside one transaction, buy the queued fee coins cheaply and keep the difference |
| DICES-04 | Low | `V001` leaves the deploying wallet as owner on mainnet unless a constant is changed; ownership is one-step |
| DICES-06 | Low | The launch-block guard exempts every user of the trusted Universal Router |
| DICES-07 | Low | A calculator that returns malformed data halts every swap; the stored level is not bounded |
| DICES-08 | Low | The swap pool keeps its original fee split after `setFeeCalculator` |
| DICES-09 | Undetermined | The fee model in the code differs from the brief as restated in `AGENT.md` (no reserve surcharge, three-way split, fees not always in USDC, no sealed game) |
| DICES-10 to 22 | Informational | Gas, dead code, documentation drift, events, test gaps, integration assumptions |

Full detail, evidence and recommendations: [`findings.md`](findings.md).

### What to do first

1. Validate `creator` in `createCoin` and the buy-and-burn recipient in the constructor (DICES-01). One line each.
2. Take DICES-02 and DICES-09 to the client. Both are questions about what was agreed, and both change constants.
3. Give fee conversion a price floor, or charge buy fees in USDC (DICES-05). This is a design change, so decide
   it before the two below.
4. Before mainnet: cap the fee in the hook, check the split, bound the level, require a contract owner in `V001`,
   and move to two-step ownership (DICES-03, DICES-04, DICES-07).
5. Decide what the launch block should allow and make the guard match (DICES-06). It also narrows DICES-05.
6. Bring `AGENT.md` and `README.md` in line with the code (DICES-17). Later phases build on the guarantees
   written there, and several are no longer true.

## Skills run

| Skill | Plugin and version | Report |
| --- | --- | --- |
| `audit-context-building` | Trail of Bits `audit-context-building` 1.1.0 | [`tob-audit-context.md`](tob-audit-context.md) and [`context/`](context/) |
| `entry-point-analyzer` | Trail of Bits `entry-point-analyzer` 1.0.0 | [`tob-entry-points.md`](tob-entry-points.md) |
| `secure-workflow-guide` | Trail of Bits `building-secure-contracts` 1.1.1 | [`tob-secure-workflow.md`](tob-secure-workflow.md) |
| `guidelines-advisor` | same | [`tob-guidelines.md`](tob-guidelines.md) |
| `code-maturity-assessor` | same | [`tob-code-maturity.md`](tob-code-maturity.md) |
| `token-integration-analyzer` | same | [`tob-token-integration.md`](tob-token-integration.md) |
| `spec-to-code-compliance` | Trail of Bits `spec-to-code-compliance` 1.1.0 | [`tob-spec-compliance.md`](tob-spec-compliance.md) |
| `fp-check` | Trail of Bits `fp-check` 1.0.0 | [`fp-check-verification.md`](fp-check-verification.md) |
| `v4-security-foundations` | Uniswap `uniswap-hooks` 1.6.0 | [`uniswap-v4-security-foundations.md`](uniswap-v4-security-foundations.md) |

Not run: the non-EVM scanners and `audit-prep-assistant` in `building-secure-contracts`, Uniswap's
`v4-hook-generator`, and Trail of Bits' `dimensional-analysis`, which writes annotations into source files.

The plugins were installed from marketplace clones dated 5 May 2026 (Trail of Bits) and 15 May 2026 (Uniswap).
The skill text is therefore six months old.

## Headline numbers from the skill reports

| Measure | Result | Source |
| --- | --- | --- |
| Code maturity | 1.7 / 4.0. Low-level manipulation and testing rate Satisfactory; access controls, decentralisation, documentation and transaction ordering rate Weak | `tob-code-maturity.md` |
| Uniswap hook risk score | 19 of 33, "High: professional audit required". 27 under the skill's other plausible weighting | `uniswap-v4-security-foundations.md`, section 9 |
| Hook permissions | 6 of 14 enabled. `beforeSwapReturnDelta` is off; the only returned delta is the `afterSwap` fee | same, section 2 |
| Spec compliance | 209 statements extracted from `AGENT.md`, `README.md` and NatSpec: 127 match the code in full, 41 contradict it, 23 describe things that are not in the code | `tob-spec-compliance.md` |
| Slither | 95 results from 101 detectors: none exploitable, 2 valid optimisations, 1 valid zero-check | `tob-secure-workflow.md`, Step 1 |
| ERC-20 conformance | `DicesCoin` passes `slither-check-erc` | `slither/check-erc20-DicesCoin.txt` |
| State-changing entry points | 38: 11 public, 11 owner-only, 1 to review, 15 contract-only | `tob-entry-points.md` |
| Tests at this commit | 127 pass in 14 suites; CI enforces 100% coverage of `src/` | baseline run |

The maturity score is pulled down by documentation and governance, not by the Solidity. Each Weak rating
traces to one of three causes: documents that describe an earlier fee design, a single unbounded owner key,
and a launch-block guard that does not bind anyone as deployed.

## How the review was done

1. **Baseline.** `forge build --sizes` and `forge test` at the commit. `DicesHook` is 23,077 bytes, 1,499 under
   the size limit.
2. **Tools.** Slither 0.11.5 detectors, six printers and `slither-check-erc`; raw output is in
   [`slither/`](slither/). Hook callback gas was measured from test traces.
3. **Separate reviews.** Five skill reviews (guidelines, code maturity, token integration, spec compliance,
   Uniswap v4) and four line-by-line context reviews were each run by a separate agent that saw only the code
   and its own skill. None was given another's results or my hypotheses.
4. **Lead review.** I read every file in `src/` and the deployment script, ran the entry-point and
   secure-workflow skills, and wrote the system model.
5. **Verification.** Every candidate from steps 2 to 4 went through `fp-check`. Eighteen proof-of-concept
   tests were written against the project's own harness and a real PoolManager, run, and then removed from
   the repository; their source and output are in [`poc-tests.md`](poc-tests.md).
6. **Independent check of the economic finding.** DICES-05 was the one finding only I had measured, so it was
   given to a separate verifier with the claim and the code but not my tests. It confirmed the finding and
   corrected it: I had concluded an attacker needs to hold coins, and the verifier showed that a contract with
   no coins and no USDC can do it inside one unlock. Its eleven tests are in
   [`poc-tests-verify05.md`](poc-tests-verify05.md); I re-ran them before changing the finding.

Agreement between the separate reviews is a useful signal: DICES-01, 03, 06 and 08 were each reported by four
or five of them. DICES-02 was found by four: two skill reviews and two context reviews.

## Files

| File | What it is |
| --- | --- |
| [`findings.md`](findings.md) | The consolidated findings, with a cross-reference to each skill report's own numbering |
| [`fp-check-verification.md`](fp-check-verification.md) | The verification record for all 30 candidates, including the 8 rejected |
| [`poc-tests.md`](poc-tests.md) | Proof-of-concept test source, how to run it, and its output |
| [`poc-tests-verify05.md`](poc-tests-verify05.md) | The independent verifier's tests for DICES-05 |
| [`tob-audit-context.md`](tob-audit-context.md) | System model: actors, workflows, invariants, trust boundaries |
| [`context/`](context/) | Per-function analysis of each module, four files |
| [`tob-entry-points.md`](tob-entry-points.md) | Every state-changing entry point by access level |
| [`tob-secure-workflow.md`](tob-secure-workflow.md) | Slither triage, security properties, manual review areas |
| [`tob-guidelines.md`](tob-guidelines.md) | Development-guidelines review across 11 areas |
| [`tob-code-maturity.md`](tob-code-maturity.md) | Nine-category maturity scorecard |
| [`tob-token-integration.md`](tob-token-integration.md) | `DicesCoin` as a token, USDC as an integration, weird-token patterns |
| [`tob-spec-compliance.md`](tob-spec-compliance.md) | `AGENT.md`, `README.md` and NatSpec against the code |
| [`uniswap-v4-security-foundations.md`](uniswap-v4-security-foundations.md) | Hook threat model, permission matrix, delta trace, checklists, gas, risk score |
| [`slither/`](slither/) | Raw Slither output |

The five skill reports written by separate agents each end with a "Reconciliation" section that maps their
local finding numbers to the `DICES-nn` identifiers and records what verification changed. Read
`findings.md` for severities; the skill reports use their own scales.

## Limits of this review

- **No fuzzing beyond Foundry, no symbolic execution.** Echidna, Medusa, Halmos and Mythril are not installed,
  and I did not install anything. Properties worth fuzzing are listed in `tob-secure-workflow.md`, Step 4.
- **No fork tests and no on-chain queries.** Behaviour of the deployed PoolManager, Universal Router, Permit2
  and USDC on Base was taken from source and documentation, not observed.
- **Slither could not analyse three functions**: `DicesHook._swapFee`, `DicesHook._addInitialTokenLiquidity`
  and `InternalSwapPool.closeInternalSwapPool`. They were reviewed by hand.
- **Dependencies** under `lib/` were read only where project code relies on a specific behaviour.
- **Off-chain practice** (key management, monitoring, incident response) is not in the repository. The
  maturity report lists the questions whose answers would change its ratings.
- **Out of scope**: the casino, rewards, bridge, forwarder and treasury phases that `AGENT.md` marks deferred.
- The Base Sepolia deployment recorded in `deployments/` predates this commit and was not compared with it.
- DICES-05 shows the limit of a single reviewer on economic questions: my own first conclusion about who could
  exploit it was too narrow. Other economic properties of the fee-conversion design deserve the same second
  look in a professional audit.

## Changes to the repository

Only this `audits/` folder was added. No source, test or script file was changed and nothing was committed.
The temporary `test/audit-poc/` directory used for the proof-of-concept tests has been removed.

After the review, `/audits/` was added to `.gitignore` at the owner's request, so this folder is local only
for now.

Two things you may notice that are not part of this review's output:

- `inheritance-graph.dot` in the repository root was there before the review and is unchanged. A fresh copy
  is in `slither/`.
- `.serena/` appeared in the repository root when the plugins were installed. It belongs to the helper server
  that ships with the `zeroize-audit` plugin, not to this review.
