Skip to main content

Crate cp_curve

Crate cp_curve 

Source

Structs§

DepositResult
Returned by deposit_amounts: how much of each token was actually used, and how many LP tokens to mint.

Enums§

CurveError
Errors returnable by every function in this crate.

Functions§

deposit_amounts
Compute how much of each input token to actually pull, and how many LP tokens to mint, given proposed deposit amounts.
integer_sqrt
Integer square root, Newton’s method on u128.
swap_output
Given pool reserves and an input amount, compute how much of the other token the swapper receives. No fee.
swap_output_with_fee
Same as swap_output but takes a fee (in basis points) from the input before the swap. The fee stays in the pool.
withdraw_amounts
Compute how much of each underlying token to return to the LP for burning lp_burn LP tokens.