Docs · Hooks

Score and verdict

How the eight checks become a number from 0 to 100 and a word, and why the two can disagree.

A report ends in two things: a score from 0 to 100 and a verdict, safe, caution or danger. They are computed separately, from the same eight checks, and they answer different questions.

The score

Each check has a weight. The weights add up to 100.

Check Weight
01 Permissions that touch your money 10
02 What it takes from a swap 25
03 LPs can get out 15
04 The fee is the fee 5
05 No one holds the switch 15
06 The code cannot change 15
07 Only the PoolManager can call it 10
08 Track record 5

A pass earns the full weight, a caution half, a fail nothing. A check that is n/a is left out of both the points earned and the points possible, so a hook is not rewarded or punished for something that could not be checked. The score is the points earned divided by the points possible, times 100, rounded to the nearest whole number.

The score is a summary of how many of the things censoredHooks looks at are clean. It is useful to sort and compare hooks. It is not a probability, and it does not weigh how bad a single failure is.

The verdict

The verdict is a rule, not a sum:

  • danger if any check fails;
  • caution if any check from 01 to 07 is a caution;
  • safe otherwise.

Safe means safe by construction: nothing that may take, no hand on a switch, a fixed fee, fixed code, and nothing measured was wrong. A hook earns it by passing (or being n/a on) checks 01 to 07. A single caution on any of them is enough to keep a hook from safe, whether it is a cost you pay now (a take in 02, an LP loss in 03, a high fee in 04) or a door left open (a return-delta permission in 01, a dynamic fee in 04, an owner in 05, DELEGATECALL or SELFDESTRUCT in 06). Check 07 has no caution: a callback either refuses a stranger or it does not.

Check 08, the track record, is the exception. A caution on 08 alone never changes the verdict. Age is not safety, and a hook that is safe by construction on its first day is still safe by construction; the caution lowers its score a little and says it has not been tested by time.

Why they can disagree

A hook can score well and still be a caution, or score well and be a danger. Six examples, worked out:

A new hook, safe by construction. No return delta, no beforeRemoveLiquidity, a fixed 0.3% fee, no owner, no proxy, guarded callbacks, clean measurements, one pool created yesterday. Only 08 is a caution. Points: 10 + 25 + 15 + 5 + 15 + 15 + 10 + 2.5 = 97.5 out of 100. Score 98, verdict safe.

A hook with an owner and a dynamic fee, both measurements clean, the fee standing at 0.3%, used by many pools for weeks. 04 and 05 are cautions; everything else passes. Points: 10 + 25 + 15 + 2.5 + 7.5 + 15 + 10 + 5 = 90. Score 90, verdict caution. Nothing measured was wrong today, but the fee and the hook's settings can change tomorrow.

A launch hook that takes 3% of each swap, with a fixed 1% fee, in a pool closed to outside LPs, with an owner, used by many pools for weeks. 01, 02 and 05 are cautions, 03 is n/a, the rest pass. Points: 5 + 12.5 + 5 + 7.5 + 15 + 10 + 5 = 60 out of 85 possible. Score 71, verdict caution.

A dynamic fee standing at 25%, with no owner, no take beyond the fee and LPs free to leave. 04 fails; everything else passes. Points: 95 out of 100. Score 95, verdict danger. A quarter of every swap goes to the fee, and the take in 02 is clean only because the fee is counted separately.

An upgradeable proxy with no owner, no take, open to LPs and well guarded. Only 06 fails. Points: 85 out of 100. Score 85, verdict danger. Everything measured was clean, and all of it can be replaced in one transaction.

A hook that lets you buy and refuses the sell. 02 fails; suppose everything else passes. Score 75, verdict danger. No number of passes makes up for not being able to sell.

How to use them

Read the verdict first. If it is danger, read the failing check's sentence: it names the problem. If it is caution, find the checks that raised it: a caution on 02, 03 or a high fee on 04 is a cost you pay now; a caution on 01, a dynamic fee on 04, or a caution on 05 or 06 is something that may cost you later. If it is safe, the hook is safe by construction as far as the scan can see; look at 08 to know how long it has been in use.

Use the score to compare hooks that share a verdict, for instance when choosing between two pools for the same token.

Neither is a guarantee. Both describe one scan at one block. See Limits.