02 / Hooks / sentient
SENTIENT
The on-chain half of an autonomous risk engine: signed, bounded regime signals that can only restrict routed flow.
01
Behavior
- An off-chain engine submits an Ed25519-signed StrategySignal; the program checks signer, nonce, freshness and the market-set TTL ceiling.
- Regimes: NORMAL, CAUTIOUS, DEFENSIVE (routed trades above the configured cap are denied) and CIRCUIT_BREAKER (routed trades are denied until the regime expires).
- Records routed buy and sell flow that the engine reads back.
Limitation. The engine never signs for users, never trades and never moves funds; signals can only restrict routed trades.
Limitation. Every signal expires; a regime lasts at most the market-set TTL (≤ 24 h).
02
Callbacks
ABI v1 · wire values frozen| # | Callback | Subscribable | Default | Semantics |
|---|---|---|---|---|
| 0 | BeforeBuy | yes | Routed buy, before the Pump CPI. Can deny. | |
| 1 | AfterBuy | yes | Routed buy, after the Pump CPI. Sees executed amounts; can still fail the transaction. | |
| 2 | BeforeSell | yes | Routed sell, before the Pump CPI. Can deny. | |
| 3 | AfterSell | yes | Routed sell, after the Pump CPI. | |
| 4 | BeforeSwap | yes | ● | Either side, before the Pump CPI. Can deny. |
| 5 | AfterSwap | yes | ● | Either side, after the Pump CPI. |
| 6 | BeforeLiquidity | reserved | Reserved (wire value 6). | |
| 7 | AfterLiquidity | reserved | Reserved (wire value 7). | |
| 8 | BeforeFeeAction | reserved | Reserved (wire value 8). | |
| 9 | AfterFeeAction | reserved | Reserved (wire value 9). | |
| 10 | OnGraduation | reserved | Reserved (wire value 10). | |
| 11 | OnStrategySignal | reserved | Reserved (wire value 11). |
03
Capabilities
granted at install; enforced by the executor| ■ | READ_MARKET | Read market config, venue reserves and the trade context |
| ■ | VETO_ROUTED_SWAP | Deny a routed trade in a before-callback (reverts the transaction) |
| ■ | WRITE_HOOK_STATE | Persist its 48-byte slot state on the market |
| □ | WRITE_USER_STATE | Update the trading wallet's per-market state |
| □ | AWARD_POINTS | Credit XP / points in the wallet's per-market ledger |
| □ | TREASURY_SIGNAL | Emit treasury allocation intents for the strategy vault |
| ■ | STRATEGY_EXECUTION | Bound or request vault strategy execution (TWAP, orders) |
| □ | ORACLE_READ | Read an external oracle account (reserved; not granted in V1) |
| □ | EXTERNAL_CPI | Call an external hook program (reserved; no permissionless CPI hooks in V1) |
| ■ | EMIT_SIGNAL | Emit or consume signed strategy signals |
04
Config schema
48 bytes · little-endian| Field | Type | Offset | Unit | Preset | Description |
|---|---|---|---|---|---|
| signer | pubkey | 0 | key | — | Ed25519 key of the off-chain SENTIENT engine |
| defensiveMaxQuote | u64 | 32 | lamports | 0.5 SOL | Routed trade cap while DEFENSIVE |
| maxSignalTtl | u32 | 40 | seconds | 3600 | Longest regime one signal may set |
| flags | u32 | 44 | flags | 3 | bit0 apply to buys, bit1 apply to sells (default both) |
05
Identity
Module ID
8 (0x0008)
Version
v1
Developer
Pump Hooks
Program
91kRNewiED… (built-in)
Priority range
3000–3999 · default 3500
Markets
bonding-curve · pumpswap
Source
crates/hook-runtime/src/modules/sentient.rs
Verification
source in this repository; reproducible-build verification not yet published
Audit
unaudited
06
