Skip to main content
All Hadron pools have price and risk curves which encode your trading strategy into the on-chain PDA. You describe a quoting function — the midprice, how price changes with trade size, how price shifts with inventory — and Hadron runs it on chain.

Q32 Fixed-Point Format

Many curve and oracle params use Q32 (Q32.32) format. This is a fixed-point number where the value is stored as an integer scaled by 2^32.
Use to_q32() for prices and price factors. Use spread_bps_to_q32() for spread values.

updateBaseSpread

Add a flat pool-level fee to all swaps.

Creating Price Curves

Write a price curve to a prefab slot. Curves define how price moves relative to the midprice as trade size increases.
  • amount_in: Amount in atoms (smallest token unit based on token decimals). Stored as u64.
  • price_factor_q32: Distance from midprice — use to_q32(factor) where 1.0 = midprice, 0.99 = 1% below.
Returns Instruction

Interpolation Types


switchPriceCurve

Switch between different price curves in a single instruction. Up to 16 per curve side (set at pool initialization).
Hadron protocol fees are added at the pool level to all pools and need to be factored into pools to remain competitive. For the latest fee rates go to https://docs.hadron.fi/fees

setRiskCurve

Write a risk curve using percent-of-vault on the x-axis. Risk curves adjust price based on your current inventory position.

setRiskCurveAbsolute

Write a risk curve using absolute token amounts on the x-axis instead of percentages.

switchRiskCurve

Switch between different risk curves in a single instruction. Up to 16 per curve side (set at pool initialization).

submit_curve_updates / apply_curve_updates

Two-step batched curve editing for modifying individual points without rewriting an entire curve. Submit a list of edits, then apply them atomically.
Buffer limit If error CurveUpdatesBufferFull (code 46) is returned, call apply_curve_updates to flush before submitting more.
For a visual helper please visit https://dashboard.hadron.fi/curves