Skip to main content

Module math

Module math 

Source
Expand description

Quote math primitives. Mirrors @pump-fun/pump-sdk-internal (bonding curve) and @pump-fun/pump-swap-sdk (AMM) so Rust callers can compute quotes locally without round-tripping through JS or the chain.

All arithmetic uses u128 intermediates; reserves and amounts are u64 at the API boundary but their products do not fit in u64.

Re-exports§

pub use bonding_curve::TOKEN_SUPPLY;

Modules§

amm
AMM (pump-swap) quoting. Ports buyQuoteInput, buyBaseInput, and sellBaseInput from @pump-fun/pump-swap-sdk/src/sdk/{buy,sell}.ts.
bonding_curve
Bonding-curve quoting. Ports getBuyTokenAmountFromSolAmount, getBuySolAmountFromTokenAmount, and getSellSolAmountFromTokenAmount from @pump-fun/pump-sdk-internal/src/bondingCurve.ts.
fees
Fee math shared by the bonding-curve and AMM quote paths.
utils
Generic numeric helpers shared by the quote builders. Pure functions — no domain types, no I/O.

Enums§

QuoteError
Reasons a quote computation can fail. Returned in place of a panic for any case where the inputs are inconsistent with a well-formed pool or trade — empty reserves, oversized requests, or fee configurations whose total bps would consume the entire trade.

Type Aliases§

QuoteResult