π±Proteus: AMM Engine
An explanation of the Proteus design
Last updated
An explanation of the Proteus design
Last updated
.
Paper 2 (September 2022) [past iteration]
Paper 1 (October 2021) [past iteration], blog post
Off the island of Pharos, an old sea god lives among the waves. He is primordial, more ancient than man, and his power of endless self-transformation is as vast as the ocean. We hope he finds here an appropriate homage.
The Proteus AMM engine is a tool that allows developers to create liquidity pools with custom bonding curves. Like its namesake, Proteus is incredibly flexible, enabling concentrated liquidity with fungible LP tokens.
Proteus is the next step in the evolution of AMMs. Itβs simultaneously more capital efficient than Uniswap v3 AND more user-friendly than Uniswap v2. It can offer excellent swap rates with only a fraction of the liquidity of its competitors. How is this possible?
An AMM, short for automated market maker, is an algorithm that takes your tokens and trades them on your behalf. For it to work, you must first tell the algorithm how much to trade in a given price bucket.
For example, you could tell the AMM to trade 10 ETH when the price ranges from $1,400 to $1,600, and trade another 10 ETH when the price ranges from $1,600 to $2,000. Overall, liquidity will be more concentrated in the $1,400-$1,600 range and less concentrated in the $1,600-$2,000 range.
The more precision you have in setting these price buckets and the more price buckets you have, the better the AMM will be at making trades and the more money it will make for you.
You can think of price buckets as pixels on a television screen. The more pixels you have, the better the image quality. Would you want a clunky TV from 2005, or an ultra-high-resolution 4K TV from the 2020s?
This is where the advantage in capital efficiency of Proteus takes shape, versus Uniswap v3. Proteus has much higher precision, and can support more price buckets than Uni v3.
Consider the DAI+USDC pool on Uniswap. Virtually all of its liquidity is concentrated between 0.9998 and 1.0002. Due to the constraints of the algorithm, itβs hard for LPs (liquidity providers) to do much better than this when using Uniswap. This is because the smallest possible price range for a bucket is 0.0001. Additionally, if you want to add more price buckets, each bucket requires minting a new non-fungible LP token, which is neither cost-effective nor convenient.
When we look at a histogram of the DAI/USDC exchange rate over the past year, it's clear that there is a lot of precision Uniswap v3 isnβt capturing. If you can find a way to match the price buckets to the data, you ought to be able to improve the performance of the AMM.
Enter Proteus. Unlike Uniswap, Proteus has practically no limit to its precision (the parameters for our first pool are specified up to the tenth decimal place). Additionally, the entire distribution can be encapsulated in a fungible token, with no need to mint multiple NFTs. The figure below shows the approximate liquidity concentration of the first deployed Proteus pool, DAI+USDC. Notice how it corresponds to the price histogram? This precision unlocks a new level of performance. To put it another way, Proteus lets us trade in 4K, better mapping our price curve to the intricacies of the market.
But, surely this level of trading performance comes at the expense of usability? Surely Proteus pools are only for the most elite financial engineers?
Nope. In addition to being more flexible and precise, Proteus is even more user friendly than Uniswap v2 (never mind v3).
If you want to LP into a Uniswap v2 pool, you must have equal amounts of each reserve token. If you donβt, youβll have to swap for the correct amounts before you LP. Proteus lets you LP with only one token, or two (they donβt even have to be equal amounts). This is known as single-sided liquidity provision.
If you want to migrate your funds from one Uni v2 pool to another Uni v2 pool, you first need to make a withdrawal. After that, you must swap (possibly twice) to get the correct ratio. Only after all this, two-to-three separate transactions in total, can you LP into the new pool.
With Proteus, migrating LP funds is literally as simple as doing a single swap.
How is Proteus so easy to use? Under the hood, Proteus is built on the Ocean, Shellβs composability layer. Moving tokens across the Ocean is seamless and gas efficient. (Read more about the Ocean and its capabilities here.)
Evolving Proteus is the version of Proteus that can create liquidity concentration that changes shape over time.
This lets anyone create pools that shift their liquidity to follow the current exchange rate, in turn capturing more trade volume and providing more utility. It can also be used to sell off tokens or NFTs with a Dutch auction style mechanism. This second method can be used for liquidity bootstrapping, and to help whales move large quantities of tokens without sudden price disruption.
Blockchain-based AMMs have never been able to compete with trading rates offered in TradFi, simply because blockchains are slower, always a step behind real-world prices. It has always been an industry-wide existential challenge to make AMMs competitive in this domain. Evolving Proteus takes us a step closer to this goal, enabling broad innovation in the creation of new market-tracking curves. These curves can change dynamically according to innovative signals of price movement, while retaining customized liquidity concentration with high precision.
Beyond this, Evolving Proteus will enable fairer and more efficient token launches, including NFT launches. With the popularity of blockchain-based games, which use large NFT collections, customizable NFT launches will be more important than ever.
Further, as the industry grows more robust, more institutions will be brought on-chain, requiring better resources for secure operations dealing with large trades. Evolving Proteus is one more tool that raises the bar for handling such operations.
In 2021, the Shell team unveiled a proof of concept for an βautomated market maker engineβ that could precisely replicate any bonding curve. Just as a video game graphics engine lets game designers build more powerful video games, Proteus would let financial engineers design more powerful AMMs.
The purpose of Proteus is not to create the most capital efficient AMM per se. The purpose is to build an AMM engine that that can implement any trading strategy. That way, financial engineers can design trading strategies without ever having to write a line of Solidity code. An operating system is an abstraction layer between application developers and a computerβs hardware. Proteusβ AMM engine is an abstraction layer between financial engineers and the Ethereum Virtual Machine.
How is this possible? An AMMβs trading strategy is determined by the shape of its bonding curve. For example, a flat bonding curve has highly concentrated liquidity, while one with high curvature has diffuse liquidity.
Proteus uses a bonding curve algorithm based on multiple curve segments stitched together in a composite function. This allows the algorithm to replicate virtually any curve, any trading strategy. While it may seem complicated, the algorithm is based on mathematics you could teach to a high school student.