Skip to main content

Module stable_math

Module stable_math 

Source

Constants§

AMP_PRECISION
Amplification precision
_MAX_INVARIANT_RATIO
Invariant shrink limit: non-proportional remove cannot cause the invariant to decrease by less than this ratio.
_MIN_INVARIANT_RATIO
Invariant growth limit: non-proportional add cannot cause the invariant to increase by more than this ratio.

Functions§

compute_balance
Compute the balance of a token given the invariant.
compute_in_given_exact_out
Compute how many tokens must be sent to a pool to take out token_amount_out
compute_invariant
Calculate the invariant for the stable swap curve.
compute_out_given_exact_in
Compute how many tokens can be taken out of a pool if token_amount_in are sent