Expand description
Shared numeric helpers for quote math.
Functionsยง
- add_
slippage value * (10_000 + bps) / 10_000. Saturates on the rare case the multiplication itself overflowsu64.- mul_
div_ u128 a * b / cinu128, surfacing overflow asQuoteError::MathOverflow.- slippage_
bounds (value - delta, value + delta)withdelta = value * bps / 10_000;Noneon overflow.- sub_
slippage value * (10_000 - bps) / 10_000.bpslarger than 10_000 saturates to 0.