-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Overview
Following the implementation of dynamic liquidity deposits in the pool, this issue tracks the creation of a swap function that uses the Constant Product Formula (x * y = k) to facilitate token swaps while preserving pool invariants. The swap should also support slippage protection to guard users against unfavorable price movements.
π Swap Logic
- Implement core swap logic using the formula:
x * y = k
where x and y are reserves of two assets in the pool, and k is constant.
- Accept input amount and calculate corresponding output using:
outputAmount = y - (k / (x + inputAmount))
- Ensure slippage is accounted
β¨ Desired Features
- Swap respects the dynamic liquidity and adjusts reserves accordingly
- Includes input/output validation and failure conditions
- Supports a frontend-calculable quote API using same formula
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request