Expand description
The constant product invariant calculator.
Structs§
- Swap
Result - Encodes all results of swapping from a source token to a destination token
- Trading
Token Result - Encodes results of depositing both sides at once
Enums§
- Round
Direction - The direction to round. Used for pool token to trading token conversions to avoid losing value on any deposit or withdrawal.
Constants§
Functions§
- calculate_
initial_ swap_ pool_ amount - Initial amount of pool tokens for swap contract, calculated as the geometric mean of the two initial token liquidity amounts.
- pool_
tokens_ to_ trading_ tokens - Get the amount of trading tokens for the given amount of pool tokens, provided the total trading tokens and supply of pool tokens.
- swap
- Constant product swap ensures x * y = constant