Crate xyk

source · []
Expand description

The constant product invariant calculator.

Structs

Encodes all results of swapping from a source token to a destination token

Encodes results of depositing both sides at once

Enums

The direction to round. Used for pool token to trading token conversions to avoid losing value on any deposit or withdrawal.

Constants

Functions

Initial amount of pool tokens for swap contract, calculated as the geometric mean of the two initial token liquidity amounts.

Get the amount of trading tokens for the given amount of pool tokens, provided the total trading tokens and supply of pool tokens.

Constant product swap ensures x * y = constant