# Entry Point Analysis: Dices launchpad

**Skill**: Trail of Bits `entry-point-analyzer` 1.0.0
**Analyzed**: 2026-11-25, commit `bcd45b2` (`main`)
**Scope**: `src/` (9 contracts and libraries, 9 interfaces)
**Languages**: Solidity 0.8.38
**Focus**: State-changing functions only (`view` / `pure` excluded)
**Tooling**: `slither . --print entry-points` (Slither 0.11.5), saved as
[`slither/printer-entry-points.txt`](slither/printer-entry-points.txt), then every row checked against the source.

This report maps the attack surface. It does not rate anything; findings are in [`findings.md`](findings.md).

## Summary

| Category | Count |
| --- | --- |
| Public (Unrestricted) | 11 |
| Role-Restricted (owner) | 11 |
| Restricted (Review Required) | 1 |
| Contract-Only | 15 |
| **Total** | **38** |

There is one privileged role in the system: the `DicesHook` owner (OpenZeppelin `Ownable` 5.6.1, one-step
transfer). No contract is upgradeable and no function is guarded by a signature, a Merkle proof or `tx.origin`.

---

## Public Entry Points (Unrestricted)

State-changing functions callable by anyone.

| Function | File | Notes |
| --- | --- | --- |
| `createCoin(CoinParams)` payable | `src/DicesHook.sol:533` | Blocked only while paused (`whenNotPaused`). Deploys a coin clone, pays the bankroll, initialises the pool and adds both launch positions inside `poolManager.unlock`. `params.creator`, `name` and `symbol` are caller-supplied and unvalidated. `msg.value` must equal `createFee`. |
| `syncLevel(address)` | `src/DicesHook.sol:408` | Reverts `UnknownCoin` for an address the hook did not launch. Calls `liveCalculator.qualify`, which writes an observation, and can raise `poolLevel`. |
| `deposit(address,address,uint256)` payable | `src/core/FeeEscrow.sol:34` | `nonReentrant`. Anyone may credit any non-zero beneficiary in any currency; ERC20 is pulled with `safeTransferFrom` and a balance-difference check. |
| `claim(Claim)` | `src/core/FeeEscrow.sol:80` | `nonReentrant`. Anyone may trigger payment; funds always go to the beneficiary. |
| `claimBatch(Claim[])` | `src/core/FeeEscrow.sol:89` | `nonReentrant`. Unbounded caller-supplied array; atomic. |
| `receive()` payable | `src/core/InternalSwapPool.sol:363` | Empty body. Nothing in the contract can send this ETH out again for a USDC pool. |
| `burn(uint256)` | `src/DicesCoin.sol:182` | Burns from `msg.sender`; lowers `totalSupply()`. |
| `transfer(address,uint256)` | solady `ERC20.sol:217` (inherited by `DicesCoin`) | Runs `DicesCoin._afterTokenTransfer` (`src/DicesCoin.sol:195`), which maintains the holder count. Transfers to `address(0)` are allowed. |
| `transferFrom(address,address,uint256)` | solady `ERC20.sol:257` | Same hook. Permit2 has an infinite allowance by default (`_givePermit2InfiniteAllowance`, solady `ERC20.sol:667`, not overridden). |
| `approve(address,uint256)` | solady `ERC20.sol:186` | Standard. |
| `permit(...)` | solady `ERC20.sol:389` | EIP-2612; the domain uses the clone's `name()`. |

Swaps are not entry points of these contracts: a trader calls a router, which calls `PoolManager.swap`, which
calls the hook callbacks listed under Contract-Only.

---

## Role-Restricted Entry Points

### Admin / Owner (`DicesHook` owner)

| Function | File | Restriction | Validation in the function |
| --- | --- | --- | --- |
| `setFeeCalculator(address)` | `src/DicesHook.sol:752` | `onlyOwner` | `code.length != 0` only (`:820`). Takes effect on every existing pool at once. |
| `setLiveCalculator(address)` | `src/DicesHook.sol:761` | `onlyOwner` | `code.length != 0` only (`:833`). |
| `setBuyAndBurnRecipient(address)` | `src/DicesHook.sol:770` | `onlyOwner` | Non-zero. |
| `setCreateFee(uint256)` | `src/DicesHook.sol:783` | `onlyOwner` | None. |
| `setFeeRecipient(address)` | `src/DicesHook.sol:793` | `onlyOwner` | Non-zero. |
| `setCoinImplementation(address)` | `src/DicesHook.sol:806` | `onlyOwner` | `code.length != 0`. Affects later launches only. |
| `pause()` | `src/DicesHook.sol:843` | `onlyOwner` | Blocks `createCoin` only; swaps are never paused. |
| `unpause()` | `src/DicesHook.sol:850` | `onlyOwner` | |
| `setTrustedRouter(address,bool)` | `src/core/TrustedRouters.sol:25` | `onlyOwner` | None. A trusted router is exempt from the launch-block guard (`src/DicesHook.sol:334`). |
| `transferOwnership(address)` | OpenZeppelin `Ownable.sol:84` | `onlyOwner` | Non-zero; one step. |
| `renounceOwnership()` | OpenZeppelin `Ownable.sol:76` | `onlyOwner` | Leaves every setter above permanently uncallable. |

### Governance

None.

### Guardian / Pauser

None separate from the owner. `pause` and `unpause` are `onlyOwner`.

### Other Roles

None. `feeRecipient`, `buyAndBurnRecipient`, the per-pool creator and the bankroll are destinations, not callers:
no function checks `msg.sender` against them.

---

## Restricted (Review Required)

| Function | File | Pattern | Why Review |
| --- | --- | --- | --- |
| `initialize(string,string,uint256,address)` | `src/DicesCoin.sol:123` | One-time `_initialized` flag, no caller check | Safe for clones, which the hook creates and initialises in the same transaction (`src/DicesHook.sol:551-554`). The implementation contract itself is never initialised, so anyone can do it once. |

---

## Contract-Only (Internal Integration Points)

| Function | File | Expected Caller | Check |
| --- | --- | --- | --- |
| `unlockCallback(bytes)` | `src/DicesHook.sol:587` | PoolManager, during the hook's own `createCoin` | `onlyPoolManager` |
| `beforeInitialize(...)` | `BaseHook.sol:36` → `src/DicesHook.sol:254` | PoolManager | `onlyPoolManager`, then `_sender == address(this)`. The PoolManager skips callbacks for the hook's own calls, so this always reverts for whoever reaches it: no third party can initialise a pool on this hook. |
| `beforeAddLiquidity(...)` | `BaseHook.sol:62` → `src/DicesHook.sol:289` | PoolManager | `onlyPoolManager`; sender must be the hook or `internalSwapPool` |
| `beforeRemoveLiquidity(...)` | `BaseHook.sol:80` → `src/DicesHook.sol:302` | PoolManager | `onlyPoolManager`; sender must be `internalSwapPool` |
| `beforeSwap(...)` | `BaseHook.sol:144` → `src/DicesHook.sol:325` | PoolManager | `onlyPoolManager`; launch-block guard |
| `afterSwap(...)` | `BaseHook.sol:161` → `src/DicesHook.sol:372` | PoolManager | `onlyPoolManager` |
| `afterInitialize`, `afterAddLiquidity`, `afterRemoveLiquidity`, `beforeDonate`, `afterDonate` | `BaseHook.sol:49`, `98`, `121`, `180`, `199` | PoolManager | `onlyPoolManager`, then `revert HookNotImplemented()`. Their permission flags are off, so the PoolManager never calls them. Counted as five entry points. |
| `deposit(address,uint256)` | `src/core/InternalSwapPool.sol:127` | `DicesHook` | `onlyHook` (`:352`). Ledger only; assumes the coins were already transferred. |
| `createInternalSwapPool(...)` | `src/core/InternalSwapPool.sol:146` | `DicesHook`, inside `beforeSwap` | `onlyHook`. Adds a position on the pool from inside the swapper's unlock. |
| `closeInternalSwapPool(...)` | `src/core/InternalSwapPool.sol:226` | `DicesHook`, inside `afterSwap` | `onlyHook`. Removes the position, settles the coin, takes USDC, credits the escrow. |
| `qualify(PoolKey)` | `src/calculators/LiveCalculator.sol:146` | `DicesHook` | `onlyHook` (`:406`), against an immutable hook address. |

`UniswapEvents` functions are `public` library functions reached by `DELEGATECALL` from the hook. A direct call to
the deployed library reverts (Solidity's library call protection), so they are not entry points.

---

## Observations for the review

These follow from the map; none is rated here.

- Every privileged action hangs off one key. The owner can change the fee rate and split of pools that already
  exist, change which contract decides levels, and change which routers skip the launch-block guard.
- `beforeRemoveLiquidity` has one permitted caller. The liquidity lock therefore rests on `InternalSwapPool` never
  removing more than it added; the PoolManager keys positions by owner, so it cannot touch the hook's positions.
- The three `FeeEscrow` functions and `InternalSwapPool.receive` are the only places an arbitrary caller hands
  value to these contracts outside a swap.
- `DicesCoin.transfer` is the hottest unrestricted path and carries custom accounting (the holder count).

## Analysis Warnings

- Slither could not generate IR for `DicesHook._swapFee` (`src/DicesHook.sol:458`),
  `DicesHook._addInitialTokenLiquidity` (`:701`) and `InternalSwapPool.closeInternalSwapPool`
  (`src/core/InternalSwapPool.sol:226`). The printer still lists `closeInternalSwapPool`; all three were read by
  hand.
- The printer lists the five unimplemented `BaseHook` callbacks without noting that they always revert, and does
  not show inline caller checks (`_beforeInitialize`, `_beforeAddLiquidity`, `_beforeRemoveLiquidity`), which are
  taken from the source.

## Files Analyzed

- `src/DicesHook.sol` (11 own, plus 10 inherited `BaseHook` callbacks and 2 inherited `Ownable` functions)
- `src/core/TrustedRouters.sol` (1)
- `src/core/InternalSwapPool.sol` (4)
- `src/core/FeeEscrow.sol` (3)
- `src/DicesCoin.sol` (2 own, 4 inherited from solady `ERC20`)
- `src/calculators/LiveCalculator.sol` (1)
- `src/calculators/FeeCalculator.sol` (0)
- `src/libraries/CurrencySettler.sol`, `src/libraries/UniswapEvents.sol` (0; libraries)
- `src/interfaces/*.sol` (signatures only)
