CAsoon

Overview

The standard

Hooks that answer, not only approve: Uniswap v4’s hook idea, on Solana, at the token level.

Why a new standard#

Token-2022 made transfer hooks safe by making them powerless: over a transfer, a hook can let it stand or make it fail. A hook on this standard keeps the safety rule, never the user’s signature, and answers instead; the token program or the DEX applies the answer.

Venues treat hooks as a risk. Meteora’s DBC revokes a token’s hook when it graduates, and DAMM v2 accepts a hook mint permissionlessly only once its hook is revoked. Orca lists hook mints case by case, and its criteria forbid hooks that charge fees or move tokens. Raydium’s CPMM and CLMM refuse hook mints unless an admin registers them. 5678

What a hook on this standard does#

Runs
Token hooks on transfers, mints and burns. Pool hooks on pool creation, liquidity and every swap.
Sees
The whole operation. A pool hook sees the trade: direction, amounts in and out, reserves, both tokens, the trader and who receives.
Answers
Up to three cuts from the amount, each to an account it names. A pool hook can also burn part of a swap and set its LP fee. A before_* callback’s answer is applied with the operation.
Keeps
64 bytes of state per holder, inside the holding. No extra account per holder.
Bounds
Never the user’s signature, never more than the amount moved. The token program or the DEX checks every answer before applying it.

Side by side#

A Token-2022 transfer hook, checked against Token-2022 v11.0.0 (the build on mainnet) and Solana’s documentation, against a hook on this standard.

A Token-2022 transfer hook and a hook on this standard compared
AspectToken-2022 transfer hookThis standard’s hook
Runs onTransfers only. Mints and burns never call it. 14Transfers, mints and burns; pool creation, liquidity and every swap.
WhenAfter the balances have changed. 14Before and after. What a before callback answers is applied with the operation.
SeesThe transfer, read-only. Not why: no buy or sell flag, no price, no pool. It can only guess. 12Owners, balances, supply, who signed. A pool hook sees the whole trade.
SignaturesNo account reaches it as a signer. 14Never the user’s either. The calling program signs every call, so a hook knows who is calling.
Over the amountLet it stand, or make the whole transaction fail. 1Up to three cuts, each to an account it names. Never more than the amount.
BurnIt can’t change an amount or burn. 1A pool hook can burn part of a swap.
A swap’s feeIt can’t set a pool’s fee. before_swap can set that swap’s LP fee.
State per holderAn extra account per holder, created and funded first, carried by every transfer. 1264 bytes inside every holding, written with the balances.
A fee from the tokens movedOnly the transfer-fee extension: one rate per mint, on every transfer alike. 13Cuts per operation: a trade can pay and a gift between wallets need not.
Refuse a transferYes. Yes.

Sources#

  1. 1Solana docs: Transfer Hook extensionsolana.com/docs/tokens/extensions/transfer-hook
  2. 2Solana docs: Transfer Hook integrationsolana.com/docs/tokens/extensions/transfer-hook-integration
  3. 3Solana docs: Transfer Fees extensionsolana.com/docs/tokens/extensions/transfer-fees
  4. 4Token-2022 program v11.0.0github.com/solana-program/token-2022 · program/src/processor.rs
  5. 5Orca: Token extensionsdocs.orca.so/developers/architecture/token-extensions
  6. 6Raydium: Token-2022 supportdocs.raydium.io/reference/token-2022-support
  7. 7Meteora: DAMM v2 Token-2022 supportdocs.meteora.ag/core-products/damm-v2/token-2022-support
  8. 8Meteora: DBC transfer hook poolsdocs.meteora.ag/core-products/dbc/transfer-hook-pools