TWAMM
Learn about how Tren Finance uses the Time-Weighted Automated Market Maker (TWAMM)
What is TWAMM?
Time-Weighted Automated Market Maker (TWAMM) is a concept introduced by researchers at Paradigm, including Dave White and Dan Robinson. It addresses the challenge of executing large orders with minimal slippage and cost-efficient gas expenses without adversely impacting market prices. TWAMM achieves this objective by autonomously breaking down large orders into smaller virtual orders, enabling a gradual and smooth execution over time.
This method minimizes the overall price impact of the trade and reduces associated gas fees. Featuring an embedded Automated Market Maker (AMM) and specialized order-splitting logic, TWAMM ensures efficient execution with low gas costs.
The involvement of arbitrageurs is key in maintaining prices on TWAMM's embedded exchange in alignment with market prices, facilitating execution near the time-weighted average price of the asset.
How does Tren Finance use the TWAMM?
Collateral Based Interest
Existing lending and CDP protocols rely on interest rates to encourage users to borrow during periods of low rates and repay their loans when rates are high. However, this model faces challenges when applied to long-tail assets that inherently lack abundant liquidity. Dealing with the concern of collateral liquidation, it becomes impractical to raise interest rates during high utilization. To prevent unnecessary compounding of principal interest, we have implemented collateral-based interest, wherein the collateral deposited in Tren is liquidated every block.
The introduction of the Time-Weighted Automated Market Maker (TWAMM) becomes pivotal in this scenario. Previous attempts at selling parts of collateral, such as Curve's LLAMMA soft liquidations, fall short, especially when dealing with the assets offered by Tren Finance. Instead, the approach adopted is to liquidate the collateral every block. While attempting this on a regular AMM would expose the process to MEV attacks and incur considerable gas fees, the TWAMM enables gas-efficient liquidation with zero risk of MEV, as orders are naturally placed at the forefront of the queue.
Benefits include assets directly contributing to the DAO treasury, enhancing the reserve factor, without waiting for the loan to be fully repaid. Furthermore, high interest rates set by liquidation-based interest models serve to protect against bad debt rather than exacerbating the issue.
Buybacks
Tren Finance, akin to Frax and MakerDAO, leverages the TWAMM to consistently repurchase the TREN token using fees generated in each pool and profits from the liquidation bot. By employing the TWAMM for the TREN token buyback, the platform mitigates the risk of MEV bots front-running the transaction. Additionally, this approach injects buying pressure into the TREN token every block through actual revenue.
Implementations
FraxSwap TWAMM
FraxSwap, being the pioneer in implementing TWAMM, aligns closely with Paradigm's original whitepaper specifications.
The TWAMM embedded in FraxSwap incorporates features outlined in the whitepaper, such as order pooling and aligning order expiries on an hourly basis. Notably, long-term orders are executed prior to any interaction with FraxSwap, optimizing execution before AMM interaction and occurring once per block, as illustrated in the schematic.
FraxSwap employs an approximation formula of Paradigm's original, resulting in a simplified and more gas-efficient TWAMM. It stands as the inaugural constant product automated market maker featuring an embedded time-weighted average market maker (TWAMM) for executing large, trustless trades over extended durations.
Operating on the Uniswap V2 framework, FraxSwap remains fully permissionless, adhering to the Uniswap V2 constant product design principles.
Uniswap v4 TWAMM
Despite FraxSwap's successful role as a Time-Weighted Automated Market Maker (TWAMM), facilitating the seamless auctioning of assets using protocol liquidity, it faces limitations in extending TWAMM functionality to every asset on Tren Finance. Specifically, only a select few assets maintain sufficient liquidity to support the TWAMM function.
In contrast, Uniswap is actively overcoming this challenge through the eagerly awaited Uniswap V4. Uniswap V4 introduces the innovative concept of "Hooks," which are contracts executed at specific points in a pool action's lifecycle. These points include pool setup, liquidity addition or removal, and trade execution. Hooks, essentially coded fragments, empower the creation of custom liquidity pools with diverse functionalities, encompassing dynamic fees, on-chain limit orders, and, notably, a TWAMM.
Tren Finance can harness Uniswap's existing liquidity and security to craft a tailored Automated Market Maker (AMM) experience for its platform.
How can TWAMM can increase LP yield?
Uniswap presently witnesses more than 50% of its trading volume originating from MEV bots. The Flashbots Explorer data indicates that Uniswap accounts for roughly 79% of the total $672 million in MEV extracted across platforms. The strategic use of Time-Weighted Automated Market Makers (TWAMMs) ensures that liquidity providers (LPs) actively partake in the benefits of MEV capture, receiving a portion of the extracted MEV alongside a reduced base swap fee.
Last updated