Plugins for a pool.
A hook is a small program attached to a pool. The pool calls it at set moments, before and after trades and deposits, and it can change what happens: the fee, the price, who may trade. It's Uniswap v4's design, and Stoke runs it on Solana. Every coin launched here is a pool with one hook, Stoke Launch, which runs its curve and its fees.
Paste a hook's address and see, in plain words, what it can do to traders and liquidity providers.
Pick what it does, get a program address that carries exactly those permissions, and a code template.
They fill in the template and deploy it, and pools on Stoke's PoolManager can use it. Launching a coin with your own hook from this site isn't available yet.
Launching or trading coins? You don't need anything on this page: every coin already uses Stoke Launch. This is for developers.
Stoke Launch: the hook every coin uses
The way launchpads are built on v4 (Doppler, Flaunch, Zora): each launch is a pool whose hook fills every swap from a bonding curve. When a buy sells the curve's last token, the hook queues adding the curve's SOL and the reserved tokens as the pool's liquidity, and the rest of that same buy fills from the pool. No migration, no second pool, nothing to snipe in between.
- Approve new pools
- Approve deposits
- Run before every trade
- Run after every trade
- Fill trades itself
- Take a cut of trades
The completing buy adds the liquidity and keeps going.
Buys in the first second pay 90%, spent on tokens that are burned.
No instruction can remove it. Fees go to the creator, stakers and the pool.
Look up any hook
Paste a hook's address to see what it can do, what that means for you, and how many pools use it.
Design a hook
Four steps. The first three need no code; the last is for whoever writes it.
Pick what kind of hook you're making. You can change anything below.
A fee override that starts high at launch and decays to the base fee. Used by Zora, Clanker v4.
Tick the moments your hook runs at and what it may change. Pools can see this list, so ask only for what you need.
- · Runs on every swap: can refuse trades or change the fee.
On Uniswap v4 and here, what a hook may do is written into its address, so nobody can change it later. Your browser tries random keys until it finds one whose address matches your choices.
Technical: permission flags 0x1080, the last 14 bits of the address.
For a developer: a Rust (Anchor) template with exactly the callbacks you picked. Fill them in, deploy with the keypair, and pools can use it.
Show the code templateHide the code template
use anchor_lang::prelude::*;
use meridian_core::*;
// Mined so its last 14 bits encode this hook's permissions (0x1080).
declare_id!("<mined program id>");
#[program]
pub mod my_hook {
use super::*;
/// Runs once a pool exists, e.g. to set its starting fee.
pub fn after_initialize(ctx: Context<HookCall>, _sender: Pubkey, _key: PoolKey, _sqrt_price: u128, _tick: i32) -> Result<HookEffects> {
let _pool = verify_call(&crate::ID, &ctx.accounts.caller, &ctx.accounts.pool)?;
Ok(HookEffects::default())
}
/// Can block a trade or change its fee.
pub fn before_swap(ctx: Context<HookCall>, _sender: Pubkey, _key: PoolKey, _params: SwapParams, _hook_data: Vec<u8>) -> Result<BeforeSwapReturn> {
let _pool = verify_call(&crate::ID, &ctx.accounts.caller, &ctx.accounts.pool)?;
Ok(BeforeSwapReturn::default())
}
}
/// The PoolManager calls every callback with [hook_caller (signer), pool, ...remaining].
#[derive(Accounts)]
pub struct HookCall<'info> {
/// The PoolManager's per-pool signer; verify_call checks it.
pub caller: Signer<'info>,
/// CHECK: verified by verify_call (owner, discriminator, and that its hook is this program).
pub pool: UncheckedAccount<'info>,
}
How Uniswap v4 maps to Solana
Same capabilities. Where Solana works differently, here is what replaces what.