What Are Hooks?
How hooks let a token market change its fees, automate a strategy, or do something much stranger.

What is a hook?
A hook is extra code that gives a token market its own rules. It can change the trading fee, put some of that fee back into the market, or make a trade trigger a reward.
When you swap tokens on a decentralized exchange, you're usually trading with a pool: a supply of two tokens that people have put there for others to buy and sell. The exchange already knows how to handle a trade. A hook lets a developer add something to that process without building a whole new exchange.
That's the idea behind Uniswap v4 hooks. The same basic exchange can support markets that behave very differently. One might charge a fixed fee. Another might change its fee when the price starts moving quickly. Another could use trading to fund a game.

The hook is part of the pool's design, so its rules apply when anyone uses that pool. Each pool can have one hook, and that hook can do several things. A pool doesn't have to use one at all.
Where can a hook plug in?
A hook can take part throughout a pool's life, not just when someone trades. A developer deploys the hook's code, and it's chosen when the pool is created. That pool can't swap it for a different hook later.
There are five kinds of action it can react to, each with a place to run code before and after:
- Creating the pool. The hook could check the starting conditions or set up its own records. This happens once.
- Adding liquidity. Someone puts tokens into the pool for others to trade against. The hook could check who is allowed to add them or record a deposit for a reward scheme.
- Removing liquidity. Someone takes their supplied tokens out. The hook could enforce that market's withdrawal rules or update their reward balance. These rules matter: a hook can restrict withdrawals, so they're part of what you're agreeing to when you supply tokens.
- Swapping. Before a trade, the hook could decide the fee. Afterward, it could record the result, update a game or reinvest some fees.
- Donating. Someone contributes tokens to the pool's liquidity providers without making a trade. The hook could check the donation or record it for a funded incentive.

A hook only uses the points its developer has chosen. It might react to trades alone, or combine trading rules with rules for deposits and withdrawals. Creation happens once; the other actions can trigger it repeatedly for as long as people use the pool.
It isn't running in the background between those actions. Something still has to happen onchain to put its rules to work.
What are the first Abyss hooks?
We started with fees. Our single-asset fee design lets a market collect its trading fees in one chosen token. For a project, that could mean getting paid in the asset people use to buy its token, rather than collecting its own token and selling it to pay the bills. We also support a model where the fee is collected in whichever token the trader puts in. Not every fee goes to the creator; protocol shares and the market's chosen fee routing still apply.
Our default v4 launch hook also keeps a price history using a truncated oracle. In plain terms, it limits how quickly its recorded price can move, rather than treating every sudden jump as the new truth. That price history is a foundation for the lending we plan to enable down the road: a lending market needs a price feed to work out how much a token is worth when someone uses it as collateral for a loan. Having the feed doesn't mean every token will qualify; lending access will still depend on risk checks and borrowing limits.
The Dynamic Fee Hook raises fees as upward price moves get faster, so traders pay more during sharp rises. The creator sets the minimum and maximum fee. The extra charge fades as the recorded move gets older.

The Hook Market Maker (HMM) is an experimental hook that uses a share of trading fees to buy and resell project tokens. It supports both fixed and dynamic trading fees. Its market-making strategy is complex enough to deserve an article of its own.
The experimental Auto Compounding Hook puts fees back to work in a different way. Some of the fees paid in the buying asset purchase project tokens. Those bought tokens are paired with the remaining buying asset and added back as more liquidity: more tokens available for people to trade against. Its allocated project-token fees are burned instead.

That extra liquidity belongs to the hook and stays permanently locked. Each successful reinvestment adds more tokens for people to trade against.
Developers can submit their own hooks to our public hooks repository for review. Authors can choose to earn royalties from a share of the creator's fee proceeds when their approved hook is used. We'll also be publishing more in-depth spotlights on our hooks as they're released.
How crazy can we get?
A trade doesn't have to end with a new token balance.
A project could fund a prize for every hundredth qualifying buyer. Now trading has a game attached to it. It's a counter, not a random lottery, so people would try to time the winning buy. Designing around that is part of the game, and the prize still needs someone to fund it.
Two cooperating markets could have a shared goal. Hit a milestone in one and unlock a bonus or a collectible in the other. Buying a token could contribute to a larger event rather than only moving its price.

Or trades could change a collectible's appearance. A community could watch something evolve as its market gets used. That needs a collectible built to allow those changes; a hook can't rewrite someone else's token.
There are less theatrical possibilities too. A funded sale could run gradually instead of dumping everything at once, as in Uniswap Labs' early time-based trading example. Trades or another service still have to trigger the work. The hook isn't a little employee waking up every morning.
Another design could lend out tokens that aren't currently needed for trading, then bring them back when they're needed. That introduces the lender's risks and the very practical question of whether the tokens can actually be returned in time.
These are possibilities, not a menu of shipped Abyss features. A hook only sees activity in the markets it's connected to, and its rewards and strategies need real funding. But within those boundaries, a market can do much more than exchange two tokens. It can become part of the project itself.