Fraxswap is a DEX based on Uniswap V2's constant product automated market maker (AMM) embedded with a time-weighted average market maker (TWAMM), which allows for efficient execution of large trades over extended periods, offering potential benefits for traders while contributing to the stability of FRAX and FPI stablecoins within the Frax Protocol ecosystem.
Core AMM:
Fraxswap's core AMM is based on Uniswap V2, utilizing the full range xy=k constant product design. Building upon the existing framework of Uniswap V2, Fraxswap extends the codebase to support TWAMM functionality. Future iterations of Fraxswap are planned to include support for concentrated liquidity and correlated asset liquidity, potentially broadening its application across a wider range of trading pairs.
Time-weighted Average Market Maker (TWAMM):
Fraxswap marks the first live implementation of TWAMM, adhering to the specifications outlined in Paradigm's original whitepaper. TWAMM enhances the execution of long-term orders through features such as order pooling, aligning order expiries, and executing long-term orders prior to any interaction with the core AMM. Fraxswap implements a simplified and gas-efficient TWAMM approximation formula, enabling seamless execution of large trades over extended timeframes.
Fundamental Mechanics:
The TWAMM mechanism facilitates trading between specific asset pairs by embedding an AMM with a constant-product market maker. Traders can submit long-term orders to the TWAMM, specifying the amount of assets to be sold over a fixed number of blocks. These long-term orders are broken down into infinitely small virtual sub-orders, which are executed against the embedded AMM at a consistent rate over time. Arbitrageurs play a crucial role in maintaining price equilibrium by trading against the embedded AMM's price to ensure optimal execution for long-term orders.
Conclusion:
Fraxswap's implementation of TWAMM represents a notable advancement in DeFi trading, offering potential benefits for traders and contributing to the stability and growth of the DeFi ecosystem. As Frax Protocol continues to explore the application of TWAMM for various market operations, the impact of Fraxswap on the broader DeFi landscape remains to be seen.