Treasury Proposal by Centrifuge: On-Chain Automated Treasury Management (with TWAMM)
Proponent: 12wWLUd5qMzLFGqBsMnHLVFeTuYJwuo5ygMAxuSywrBX1XSF
Date: 2023.03.30
Requested DOT: $495,000 ~ TBD DOT
Contact: William Freudenberger (william@k-f.co)
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.
Comments (2)
$150/hr for frontend developer? What seriously? Where are these geniuses coming from that charge this exorbitant amount? $200/hr for substrate developers. Centrifuge team exploiting the treasury just because of the existing reputation?
Hello Team,
Thank you for submitting this proposal for review/discussion by the Community.
A few comments:
Q: Can you please clarify whether you are seeking to provide a completely different alternative to the proposed Statemine/t DEX or adding extra functionalities for this future DEX?
Q: Will this solution be available for integration by other existing parachain/DEXes? If so, how will you spread the word about your solution within the Polkadot ecosystem to expand the reach of your TWAMM?
Q: Which timelines are you looking at for the completion of the milestones in this proposal, given that the Common-good DEX is not deployed yet?
Q: The PAL bounty has been proposed by a collective of parachain teams to finance part of the audits conducted on Polkadot ecosystem protocols. Would you consider applying for this bounty to cover the cost of your audit when the time comes for your solution to be audited?
S: Please consider breaking down the above budgeted milestones into separate Treasury proposals with their own costs and reporting requirements, so that the community can have the opportunity to track and review the proposal's progress in the medium term.
Hi Anaelle,
Thank you for your questions regarding our treasury proposal. We have been in close contact with Parity regarding the development of TWAMM and have received positive feedback so far. Our recent collaboration on the development of a Multi Asset Treasury (e.g. Substrate #13602, Substrate #13608) has highlighted the necessity of having a non-attackable long-term tokenswap mechanism like TWAMM (e.g. see the draft for Multi Asset Treasury).
As outlined in the proposal deliverable breakdown,, we are not planning to build an alternative DEX. Instead, TWAMM will be a feature on top of the Statemine/t DEX, whose logic was renamed to
pallet-asset-conversion
(Substrate PR #12984) as a result of discussions on the Polkadot forum. Whilepallet-asset-conversion
will remain independent of our TWAMM pallets, TWAMM expects an embedded AMM interface via the pallet'sConfig
trait, which will be based onpallet-asset-conversion
, making it easy for any chain implementingpallet-asset-conversion
to add TWAMM to their runtime with minimal overhead.In addition to the simple integration statement above, parachains will also have the option to plug in their custom DEX as the embedded AMM of TWAMM instead of
pallet-asset-conversion
.We hope to discuss this further in the next iteration of Polkadot Decoded or Sub0, and we also plan to showcase it in Substrate Seminar. Furthermore, we will share this information with the parachain teams we have regular conversations with and meet in upcoming ecosystem events, as we believe it would be valuable for the community.
Although our design is somewhat dependent on
pallet-asset-conversion
, we can still develop TWAMM beforepallet-asset-conversion
is completed, as we can base it on an abstract interface for the embedded AMM. In the event that breaking changes are introduced topallet-asset-conversion
API, we will need to apply those changes to our embedded AMM interface as well. However, we do not anticipate any issues in this regard, as to our knowledge,pallet-asset-conversion
is already undergoing audits by SRLabs.We are planning to start the development in Q2 and complete it by the beginning of Q4 2023.
To our knowledge, the PAL is intended for general parachain audits and may not cover specific shared functionality audits like TWAMM. Moreover, k-factory (the core team building Centrifuge) has already discussed a pre-commitment with SRLabs, which gives us certainty over the timeline of the audit process.
We appreciate your input and your desire to track and review our proposal's progress. We understand that breaking down the budgeted milestones into separate Treasury proposals with their own costs and reporting requirements can provide more transparency to the community. However, we would like to highlight that this approach may add additional overhead and administrative burden on our team, potentially affecting our ability to focus on delivering the actual project outcomes.
We also want to assure you that Centrifuge has a proven track record of delivering on previous grant proposals in the past. We are committed to transparency and accountability, and we will continue to provide regular updates on our progress throughout the medium term. We value your support and feedback, and we will take your suggestion into consideration while ensuring that we can effectively execute our proposal and deliver the intended outcomes. Thank you for your understanding.