Requested DOT: 74,785 DOT ($495,000)
Contact: William Freudenberger (firstname.lastname@example.org)
Discussion Post: https://polkadot.polkassembly.io/post/1754
The ongoing discussion about automated market makers (AMMs) in the Statemint roadmap is mainly focused on improving the user and custodian experience by allowing small atomic swaps natively and making Statemint a central hub for asset deposits. This addresses important pain points by enabling transaction fees to be paid in non-native tokens and facilitating interaction with the entire asset variety of the ecosystem without requiring to run custom nodes or infrastructure.
However, we believe that one aspect has been overlooked: the slow swaps of large volumes, which can be easily front-run or sandwiched. This is particularly relevant in the context of trades proposed through governance for use cases such as
- Paying out treasury grants, bounties or even salaries in less volatile currencies (ie. stablecoins).
- Enabling parachains to build a DOT reserve which can be used to acquire a parachain lease, pay XCM fees, or increase availability cores during times of high demand (once supported).
- Governance deciding to invest part of the treasury into a token to diversify their treasury
What we need is the opposite of what a traditional AMM provides: atomic swaps with immediate execution, even in relatively illiquid assets. A governance vote is unable to time the market and is highly predictable. Therefore, executing such a transaction as a market order on an AMM is problematic, as it will be guaranteed to be front-run. A better solution is to "dollar-cost-average" over a long period of time making it harder for price manipulation to affect the purchase.
At Centrifuge, we have researched distinct approaches of how to achieve hard-to-front-run slower transactions. In our opinion, the most elegant solution is TWAMM (Time Weighted Automated Market Maker. We are of the firm conviction that the implementation of this model represents the most efficacious approach for executing token swaps in the context of slower and passive procedures, such as governance.
TWAMM (Time Weighted Automated Market Maker) eliminates front-running vulnerabilities of traditional AMMs when executing large orders, especially in the context of passive procedures, such as governance. The proposed solution will be executed as a seamless extension to pallet-asset-conversion, thereby enhancing its capabilities as an embedded AMM.
The deliverables of the proposal contain the TWAMM-pallet, associated runtime APIs, associated research for further optimizing and extending the pallet, a security audit of the pallet and a frontend.
The full proposal can be found here.
- Link discussion post