Skip to content
Solana
ADVISORYIn the programBit 14

Market Guard

Swaps that stray from a live Pyth price pay the pool's LPs a surcharge.

Where it runs

Advisory

The pool's single add-on slot: one per pool.

Status on reel

In the program

In the reel program: bit 14 of PoolParams.blocks, frozen at PoolInit (PROGRAM.md §5).

Set by

You, at launch

Frozen in PoolParams at PoolInit; nobody can change it after.

What it does

Every swap compares the pool's price with an oracle. Inside ±band nothing changes. A swap that ends past the band and moves further away pays a surcharge that ramps from 0 to the full rate over one ramp width; moving back is free. If the feed is missing or stale, the pool refuses every swap, sells too, until it updates.

How it works on reel

Reads a Pyth PriceUpdateV2 account (owner rec5EKMG…, full verification, tag checked, publish_time within oracle_max_age); guard_flags bit 0 inverts the feed. Surcharge = guard_surcharge_pips·min(1, over/ramp), all to LPs; below guard_min_depth of quote to the band edge the full surcharge applies. A stale or missing feed fails closed with OracleUnavailable. With Arb recapture on the same pool, recapture must read the same Pyth feed (recap_ref 1).

Named at launch: oracle (Pyth PriceUpdateV2)

Settings · 6

SettingMinDefaultMaxWhat it does
Band
guard_band_bps
0.5%10%50%Each way around the oracle price; swaps that end inside it pay nothing extra.
Ramp
guard_ramp_bps
0.5%10%50%Past the band, the surcharge rises from 0 to full over this distance.
Full surcharge
guard_surcharge_pips
0.0001%1%5%Paid by swaps that end past band + ramp and move away. 100% to LPs.
Price age limit
oracle_max_age
1 min25 h25 hA feed older than this refuses every swap, sells too (fail-closed). Market Guard only.
Least depth
guard_min_depth
0 (off)0 (off)—If quote depth to the band edge is below this, the full surcharge applies. 0 = off.
Feed orientation
guard_flags
NoneNoneInvert the feedBit 0 inverts the feed, for a pool whose base is the feed's quote.

Fees and who's paid

Paid to

LPs, 100%. reel keeps none of it.

Protocol share

reel takes no share of it.

Requires and can't be combined with

Requires

No other block.

  • A Pyth feed for the exact pair, passed as the oracle at PoolInit
  • A new token has no feed, so it suits tokens that already trade
  • Pin Pyth's sponsored push feed (the Push Oracle's shard-0 account for the feed id), which anyone can refresh; any other writer can halt the pool by not posting. The pool's Details tab names the writer and warns unless it is that feed

Worked example

A SOL/USDC pool 25% above Pyth's SOL/USD with a 10% band and 10% ramp: a 1,000 USDC buy of SOL pays the full 1% surcharge (10 USDC) plus the 0.3% base fee (3 USDC), all to LPs.

Solana notes

Pyth instead of Chainlink. hookr's circuit-breaker mode is held there and is not in reel.

On hookr: Advisory · Live (Chainlink)

Other blocks in Protection and access