Rule Execution
The order the hook actually applies things in.
Where the hook runs
TAPEZERO uses three Uniswap v4 callbacks: beforeInitialize, beforeSwap and afterSwap. The hook's address encodes exactly those permissions, which is why it is deployed to a mined CREATE2 address.
| Callback | What it does |
|---|---|
| beforeInitialize | refuses to let a pool exist with this hook unless the market's configuration is already registered |
| beforeSwap | charges the quote-side fees, or takes the burn when the specified amount is on the launch side |
| afterSwap | enforces the anti-snipe cap and burns from the realised output |
A buy, step by step
- 01Swap arrives at the PoolManager
- 02beforeSwap: market must be registered
- 03Classify: buy or sell, exact-in or exact-out, which side is specified
- 04Quote fees computed and taken as a hook delta
- 05Pot counter advances, before any token moves
- 06Pool executes the swap
- 07afterSwap: anti-snipe cap checked against this block's cumulative outflow
- 08Auto burn taken from the launch-token output
- 09Vault credited, events emitted
Which fees apply to which direction
| Component | Buys | Sells |
|---|---|---|
| protocol fee | yes | yes |
| creator fee | yes | yes |
| launch tax | yes, while decaying | no |
| anti-snipe extra fee | yes, inside the window | no |
| pot contribution | yes, if the buy qualifies | no |
| auto burn | yes, on the token output | no |
Rounding and accounting
Every fee component is bps × amount / 10000, rounded down — which favours the trader — and the total is the sum of the already-rounded components, so the vault's accounting is exact with no dust left over.
Fees are collected as Uniswap ERC-6909 claim tokens rather than ERC-20 transfers. On a market's first buy the PoolManager holds no quote asset at all, so a real take would try to move tokens that are not there yet. Minting a claim to the vault moves accounting only, nets against the hook's returned delta inside the same unlock, and leaves the vault holding something it can redeem on demand.
TAPEZERO is an independent protocol and is not affiliated with Robinhood, Uniswap or Chainlink. The contracts are unaudited. Nothing here is investment advice.