Hooks.wtf

Core contracts

DicesCoin.sol

DicesCoin is the cloneable launch token and tracks qualifying holders. The findings concern implementation initialisation, Permit2 allowances and input bounds; shared findings cover holder arithmetic and the effect of burns.

Reviewed source: src/DicesCoin.sol at commit bcd45b2.

Findings

IDSeverityFinding
DICES-12InformationalAnyone can initialise the coin implementation
DICES-15InformationalEvery holder gives Permit2 an infinite allowance
DICES-22InformationalUnbounded inputs

[INFORMATIONAL] DICES-12 · Anyone can initialise the coin implementation

Affected modules: DicesCoin.sol.

Severity: Informational.

DicesCoin.initialize has a one-time flag and no caller check (src/DicesCoin.sol:123-138), and the constructor does not set the flag. Clones are unaffected: each has its own storage and is initialised in the transaction that creates it. A stranger can turn the published implementation address into a token with any name and a supply minted to themselves (testPoC7_anyoneCanInitialiseTheCoinImplementation). Recommendation: set _initialized = true in the constructor.

Recorded test source and output: poc-tests.md.

Source finding: findings.md, DICES-12.

[INFORMATIONAL] DICES-15 · Every holder gives Permit2 an infinite allowance

Affected modules: DicesCoin.sol.

Severity: Informational.

solady's ERC20 grants the canonical Permit2 contract an unlimited allowance by default (_givePermit2InfiniteAllowance, solady ERC20.sol:667-669) and DicesCoin does not override it. It cannot be revoked, and approve(PERMIT2, x) with x below the maximum reverts (testPoC15_permit2AllowanceIsInfiniteAndFixed). A signed Permit2 message is still needed to move coins. Recommendation: keep it if the gas saving for Universal Router users is wanted, and document it; otherwise override the function to return false.

Recorded test source and output: poc-tests.md.

Source finding: findings.md, DICES-15.

[INFORMATIONAL] DICES-22 · Unbounded inputs

Affected modules: DicesHook.sol, DicesCoin.sol, TrustedRouters.sol.

Severity: Informational.

Coin name and symbol are stored as given (src/DicesCoin.sol:133-134): front ends must escape them and may want a length limit. setCreateFee accepts any value (src/DicesHook.sol:783). setTrustedRouter accepts the zero address (src/core/TrustedRouters.sol:25). None has an on-chain consequence that was found.

Source finding: findings.md, DICES-22.

Shared findings

Previous
DicesHook.sol