cp-curve
constant product (x*y=k) amm math primitives. no_std rust.
api
swap_output(reserve_in, reserve_out, amount_in)— swap, no feeswap_output_with_fee(reserve_in, reserve_out, amount_in, fee_bps)— swap with fee in bpsdeposit_amounts(reserve_x, reserve_y, total_lp, amount_x_in, amount_y_in)— lp deposit, first-deposit via integer sqrtwithdraw_amounts(reserve_x, reserve_y, total_lp, lp_burn)— proportional withdrawinteger_sqrt(value)— u128 newton's method
errors
CurveError: Overflow, ZeroInput, EmptyPool, InvalidFee, InsufficientLpSupply.
test
cargo test