Pump Hooks
02 / Hooks / volatility-guard

Volatility Guard

Denies routed trades when the venue's on-chain spot price deviates too far from an EMA of routed observations.

RISKruntime moduleunaudited
01

Behavior

  • Spot price is read from on-chain reserves of the bonding curve or PumpSwap pool; no oracle.
  • The EMA updates after each routed trade; enforcement starts after a minimum number of observations.
  • Small trades below a threshold are not checked.
Limitation. Observations are sparse: they happen on routed trades, so the EMA reflects routed history rather than every Pump trade.
02

Callbacks

ABI v1 · wire values frozen
#CallbackSubscribableDefaultSemantics
0BeforeBuyyesRouted buy, before the Pump CPI. Can deny.
1AfterBuyyesRouted buy, after the Pump CPI. Sees executed amounts; can still fail the transaction.
2BeforeSellyesRouted sell, before the Pump CPI. Can deny.
3AfterSellyesRouted sell, after the Pump CPI.
4BeforeSwapyes●Either side, before the Pump CPI. Can deny.
5AfterSwapyes●Either side, after the Pump CPI.
6BeforeLiquidityreservedReserved (wire value 6).
7AfterLiquidityreservedReserved (wire value 7).
8BeforeFeeActionreservedReserved (wire value 8).
9AfterFeeActionreservedReserved (wire value 9).
10OnGraduationreservedReserved (wire value 10).
11OnStrategySignalreservedReserved (wire value 11).
03

Capabilities

granted at install; enforced by the executor
■READ_MARKETRead market config, venue reserves and the trade context
■VETO_ROUTED_SWAPDeny a routed trade in a before-callback (reverts the transaction)
■WRITE_HOOK_STATEPersist its 48-byte slot state on the market
□WRITE_USER_STATEUpdate the trading wallet's per-market state
□AWARD_POINTSCredit XP / points in the wallet's per-market ledger
□TREASURY_SIGNALEmit treasury allocation intents for the strategy vault
□STRATEGY_EXECUTIONBound or request vault strategy execution (TWAP, orders)
□ORACLE_READRead an external oracle account (reserved; not granted in V1)
□EXTERNAL_CPICall an external hook program (reserved; no permissionless CPI hooks in V1)
□EMIT_SIGNALEmit or consume signed strategy signals
04

Config schema

48 bytes · little-endian
FieldTypeOffsetUnitPresetDescription
maxDeviationBpsu320bps1500Deny when |spot − EMA| / EMA exceeds this
emaAlphaBpsu164bps2000Weight of a new observation in the EMA
minObservationsu166count5Observations before enforcement
checkMinQuoteu648lamports0.1 SOLTrades below this are not checked
flagsu3216flags3bit0 check buys, bit1 check sells (default both)
05

Identity

Module ID
3 (0x0003)
Version
v1
Developer
Pump Hooks
Program
91kRNewiED… (built-in)
Priority range
1000–1999 · default 1200
Markets
bonding-curve · pumpswap
Source
crates/hook-runtime/src/modules/volatility_guard.rs
Verification
source in this repository; reproducible-build verification not yet published
Audit
unaudited
06

Registry

Install on a Pump market ›