KIP-20: Fund an R&D grant to study a dedicated arbitrage service for TWAMM


Fund research and development of arbitrage facilities for on-chain liquidity pools, with immediate application to the time-weighted average market maker (TWAMM).


About the team

AC and I are software developers with over 35 years of experience in FPGA tools (simulation, place & route, analysis), web technology, and building tooling for blockchain ecosystems.

We’ve built Web3 tooling and infrastructure products for our past startups, MakerDAO, Aave, Balancer, Uniswap, the Graph, and others.

We have been independently researching and developing TWAMM for the past 4+ months. See below our various monthly blog posts on TWAMM:


We’re building a new type of AMM purpose-built for time-insensitive trades that happen over multiple blocks. These trades can range from very large — think OTC trades for DAOs, Funds, whales, to small trades for retail (dollar-cost averaging).

As this is new and unexplored territory, there will be a heavy emphasis on research and development like optimal AMM designs, fee structures, gas optimizations, attack vectors, testing, and simulations.

Arbitrage and TWAMM

TLDR; Prove TWAMM with KeeperDAO (MEV share + “right to first arbitrage”) is more profitable for LPs than Uniswap V2 fee structure.

Arbitrageurs play a very important role to ensure the proper functionality of TWAMM and keeping the asset prices in the liquidity pools in line with the wider market. Unlike traditional AMMs, when there’s an active long-term swap, the cost to interact with the underlying AMM increases every block. See the section under inactivity in our last blog post for more information:

When there are frequent arbitrages happening, traders get lower slippage and a significantly better return than trading on DEX aggregators for large swaps. Here’s how a pseudo-TWAMM performed vs 1Inch: The arbitrage powered trade netted $5.4M vs $3.5M quoted by 1Inch, a +54% improvement!

Similar to Uniswap V2, we could build TWAMM with a flat fee and allow arbitrageurs in the free market to correct the prices and extract all the MEV. However, we’ve seen how that has adversely affected LPs in the long run — see Uniswap V2 is the largest MEV leaker accounting for 64% of MEV extracting arbitrage trades, something that could have been avoided:

TWAMM’s underlying AMM will allow LPs to passively deposit tokens similar to Uniswap V2 across the entire range from 0 → infinity. Additionally, we expect almost the entirety of the trade traffic on the underlying AMM to be from arbitrageurs. Therefore, we are interested in researching the advantages a system like KeeperDAO provides in order to add MEV protection for passive LPs:

About the research

This grant will focus on the delivery of methods for efficient arbitrage of TWAMM contracts, in collaboration with developers at KeeperDAO. Though focused on TWAMM, we expect that any findings will generalize to other types of AMM.

Research topics will include:

  • Simulation and experimental measurement of arbitrage rates under different network conditions, fee regimes, liquidity conditions, and coordination scenarios.
  • Investigation of static and dynamic liquidity fees and their impact on arbitrage rates TWAMM performance.
  • Design considerations of integrating arbitrageurs with TWAMM, taking into account factors such as smart contract design, performance, trustlessness, security, and gas efficiency.

About the grant

The grant is structured as a 3-month research and development investment, in the form of:

  1. 200,000 USDC, streaming
  2. 200 ROOK, on successful completion

These amounts are derived from the KeeperDAO Contributor Incentive Guidelines. We computed three months total compensation for two L4 engineers, then discounted it by 20%. We believe this is a fair balance between recognizing that we will not be full-time contributors for KeeperDAO, but that we will be building in concert with KeeperDAO engineers, and ultimately contributing potentially large amounts of value.

Receiving the majority of the value in stable coins will help us plan and cover living expenses and other operational costs more easily so that we can dedicate our full time to the development of TWAMM. It will also reduce the need to liquidate ROOK to cover those costs.

However because we also value long-term incentive alignment, we include a 200 ROOK completion bonus.


  1. 200,000 USDC and 200 ROOK from the DAO Treasury shall be set aside to fund the research and development of the TWAMM project.
    • 200,000 USDC from (1) shall be deposited into a Sablier stream ending June 28, 2022, claimable by an address controlled by the TWAMM project.
    • 200 ROOK from (1) shall be transferred to an address controlled by the TWAMM project on successful completion of the grant goals.
  2. Research progress will be continually monitored by developers and a grant project manager from KeeperDAO to ensure adequate progress.
  3. The grant project manager from KeeperDAO may terminate the grant at their discretion. Any unpaid funds at the time of termination shall be returned to the DAO Treasury.

@0x70626a and colleague AC have probably already become the leading experts on TWAMM technology, so I encourage everyone to ask questions and learn more about what they are building and why.

We’ve had a chance to talk for a number of weeks and I’m excited to see this proposal get posted.

A particular strength of their work has been a diligent and data-driven approach that is well suited to fully exploring how the Coordination Protocol can enhance LP/trader performance through more efficient arbitrage. That work has particularly high applicability in the case of TWAMM, but can generalize to other AMMs and instruments as well.

Interested to see some discussion on this.


This is a very well-written and thought-out proposal - thank you.

I am in full support of this proposal. This is exactly the type of activity we should be backing with our capital as this has major implications on the ecosystem and the space we play in.

With that being said, two quick questions for you:

  1. What are the major milestones that we can expect to see as this project progresses?
  2. How can we balance informing our community of the progress made while also allowing you to keep proprietary information close to the chest?

Thanks for the positive feedback @hazard and @DaddyMatty!

  1. What are the major milestones that we can expect to see as this project progresses?

As TWAMM is a relatively new DeFi lego block, the R&D around the various aspects (math, simulation & modeling, gas, solidity, security, etc) are fluid and very intertwined, therefore hard to separate into milestones.

At a high level the project goals are centered around the following topics:

  • Gas optimization: ensuring the gas cost of interacting with the TWAMM contract is reasonable so Arbitrageurs interact with it more often and prices in the AMM stay in line with external sources.
  • AMM research: exploring the benefits Balancer Vaults V2 gives in terms of gas savings with internal user balance, and batch swaps.
  • MEV protection: as described in the about the research section, we want to prove the advantages of first right arbitrage for LP returns versus a flat fee structure.

There are other topics I’ve not specifically called out here like smart contract testing, simulations, numerical analysis, etc that will be an ongoing topic as product development continues.

Our goal is to have a beta by end of June with a single pool (ETH/USDC) and have a full launch a few weeks after that with a factory, router, and other infrastructure pieces. We already have a few early users in the pipeline (DAO infrastructure tooling, stable coin projects, etc) that will be onboarded at the time of the soft launch.

  1. How can we balance informing our community of the progress made while also allowing you to keep proprietary information close to the chest?

As you can see in the about the team section, we’ve published monthly blog posts on our progress and findings for the past 4 months and will continue to do so. Furthermore, you can see other TWAMM related threads and announcements on my Twitter account as well.

We also plan on participating in future community calls to help educate the KeeperDAO community on TWAMM and its benefits to the ecosystem.

1 Like

Thank you for that.
Just to clarify: when would we need to pay the 200 ROOK exactly? It says upon “successful completion of the grant goals.” Are those goals you mentioned above the criteria for that? Just trying to understand things from a flow perspective.

Yes, after we prove the MEV protection added by KeeperDAO is beneficial for LPs and the contract is on mainnet by end of June.


There’s a nice visual update on this research with an assist from Rook’s @watts in this twitter thread from yesterday (7/28):

1 Like