Expand description
Generic numeric helpers shared by the quote builders. Pure functions โ no domain types, no I/O.
Functionsยง
- add_
slippage value * (10_000 + bps) / 10_000. Saturates on the rare case the multiplication itself overflowsu64.- slippage_
bounds (value - delta, value + delta)wheredelta = value * bps / 10_000. ReturnsNoneif any intermediate overflowsu128โ callers can map that tocrate::math::QuoteError::MathOverflow. Mirrorshandle_bpsfrommayhem-program::mathso bothvalidate_market_cappaths can share a slippage envelope.- sub_
slippage value * (10_000 - bps) / 10_000.bpslarger than 10_000 saturates to 0.