Overview
CurveLib is an internal Solidity library used by BondingCurve. It implements the constant-product AMM math with virtual reserves (pump.fun style). All functions are pure — no state reads or writes.
Deployment Addresses
Library functions are inlined at compile time —CurveLib has no separate deployment address.
Invariant
k = virtualEth * virtualTokens (set at initialization).
Spot price at any point: ethReserve / tokenReserve
Initial price: virtualEth / virtualTokens
Functions
getTokensForEth
getCostForTokens
tokenAmount >= tokenReserve.
getRefundForTokens
getCurrentPrice
Precision
All division uses OpenZeppelin’sMath.mulDiv for full-precision (a * b) / c without intermediate overflow.