frogs-logo

A product of the New Order DAO

HomeFrogs ProNewsletterSubmissions
Back
28gjojVZUaFGLDGVNizfpP

CrocSwap: The Next Generation AMM

Automated Market Makers (AMMs) are broadly considered DeFi’s 0 to 1 innovation. Pioneered by Bancor and perfected by Uniswap, AMMs enable users to partake in arguably the most popular activity in DeFi: Trading.

Trading in a permissionless environment where users could also fill the role of a market maker was something that hadn’t been seen before. So it was no surprise that AMMs quickly rose to become one of the most popular DeFi applications out there. They are now a core component of every new Layer 1 ecosystem.

AMMs come in many different shapes and sizes. There is a constant product AMM, constant mean AMM, constant function AMM, an AMM with multi-asset pools, and so on. Each AMM makes a set of trade-offs to differentiate themselves from the others. While innovation in this space is rampant, Uniswap can still be considered the gold standard of AMMs.

Uniswap's Dominance

In terms of 7-day DEX volume, Uniswap controls 66.5% of the market share. It has the greatest amount of active daily traders with a lead of 47,000 more daily traders than the DEX in second, and it also dominates daily DEX volume. As a result, it is the most forked protocol in the entire crypto space and it is completely dominant in its sector

DEX Market Share By Volume

DEX Market Share By Volume

Although Uniswap is dominant in its category, that doesn’t mean that there aren’t people working in the background to chip away at its market share and dethrone the king. Many have tried so far and many have failed, but there is a new competitor that’s emerged from the shadows. A competitor that isn’t simply making a few tweaks to the popular AMM design, but changing the whole game.

For a number of reasons, I believe CrocSwap has the potential to pose a genuine challenge to Uniswap's dominance. Before getting into the details of how it could do so, however, we need to look at the existing issues with AMMs to understand its importance. First, let's take a look at some of the problems that are present within Uniswap.

Liquidity Today

Liquidity is at the heart of DeFi and is the core component of any DEX. Liquidity provision, therefore, acts as the heartbeat of any AMM. Uniswap has always been at the forefront of this race by constantly innovating and creating novel methods of liquidity provision. There are two methods of liquidity provision that present problems here. Concentrated liquidity and Just-In-Time (JIT) liquidity.

Concentrated liquidity is a more capital efficient mechanism which allows LPs to provide liquidity within a specified price range, with an upper bound and lower bound set by range orders. The tighter the range and the longer price trades within that range, the more fees the LP will earn making it more profitable for them.

The problem is that this complexity requires participants to be sophisticated. Being successful requires constant monitoring of positions, assessing of volatility, and anticipating where price moves next. As a result, most LPs actually end up losing money through concentrated liquidity due to Impermanent loss.

Percentage of Open Uniswap Liquidity Positions in Range (ETH and APE)

Percentage of Open Uniswap Liquidity Positions in Range (ETH and APE)

A study done by @0xfbifemboy proves just this. When analysing the ETH/USDC pool on Uniswap V3, his research showed that only 48.6% of LP positions are profitable. However, a study he conducted on Apecoin, a more high-risk asset, showed that on the first day of active trading, within the first 12 hours over 85% of LP position for APE/ETH & APE/USDC were in range and in profit but over the next 12 hours that number fell to only 50% for APE/ETH and 30% for APE/USDC. So even though concentrated liquidity is a more efficient system, it seems most people would be more profitable by using classic liquidity provision or simply holding the asset.

JIT liquidity can require even more sophistication. JIT liquidity is when a JIT trader spots a pending transaction that is yet to be committed to the chain, based on the transaction they flash in a sizable amount of concentrated liquidity and collect the lions share of the fees and then flash out, all possibly within a single block.

JIT liquidity does improve the execution environment and can be considered fair game since they are taking advantage of public information, but it is a problem for passive LPs. They are losing a sizeable portion of their yield to active LPs who take much less risk and show much less commitment than them. This could lead to a situation where all passive LPs leave the pool and no firm quotes will exist in the market.

Gas Fees

Gas efficiency on Uniswap is acceptable. However, there is plenty of opportunity to make AMMs significantly more gas efficient. Creating new pools, moving assets between pools, conducting multipool operations, constantly adjusting your concentrated liquidity LP position, updating the token contract, and adding liquidity are all examples of actions that use gas. While gas is not always brought up as a major concern, there are tweaks that can be made to make all of these actions significantly more gas efficient, which improves the experience both from the users side and the developers side.

While these are two major issues that Uniswap faces, they are by no means all of them. So what is it that CrocSwap proposes?

The CrocSwap Solution

CrocSwap’s most significant improvement comes from the protocol’s architecture. It is a single smart contract DEX. That means the entire DEX ranging from liquidity pools to individual transactions runs on one single smart contract. This alone significantly improves gas efficiency.

Within this single smart contract structure, there are lightweight data structures which represent the liquidity pools. Rather than using the traditional model of having each liquidity pool as its own smart contract, having them as lightweight data structures allows for major gas reductions when it comes to basic transactions, complex multipool strategies, moving collateral across pools, and initializing pools.

Liquidity Reimagined

Under the hood of this architecture comes the technical specifications for liquidity. CrocSwap also uses a constant product liquidity curve just like Uniswap, but the point of differentiation comes from the liquidity provision mechanisms. CrocSwap allows for both concentrated liquidity & Ambient liquidity on the same AMM.

Side note: for those who don’t know. Ambient liquidity is the classic way of providing liquidity where LPs simply deposit their assets without needing to set a range of prices and they collect fees proportional to the size of their LP position.

On Uniswap V3, you might think that ambient liquidity could be provided by simply opening a concentrated liquidity position with arbitrarily large range. However, there are safeguards in place that make this method a lot less profitable and less efficient. For one thing, the wider the range is, the lower the share of fees you earn. Additionally, the other LPs who will be constantly readjusting and playing tighter ranges will be much more profitable than you.

As I mentioned earlier, its more profitable to provide concentrated liquidity for the majors because liquidity is higher and volatility is lower, and its also more profitable to provide ambient liquidity on the higher-risk, long-tail assets. To do this on Uniswap, you would have to constantly swap between V2 and V3.

A Hypothetical Example of Dual Liquidity

A Hypothetical Example of Dual Liquidity

On CrocSwap, it can be done in one place with additional tooling provided to make the experience easier for less sophisticated participants. An added benefit for LPs is that each liquidity pool will have multiple fee-tiers for LPs to participate in. This gives LPs a level of customizability in strategy and position management that hasn’t been seen before. In previous AMMs, only a few assets have multiple fee-tier pools while the rest have a standard fee-tier.

A bonus for LPs is that rewards are automatically accumulated. Rather than having to manually “collect” rewards which are sitting idle, CrocSwap auto-collects them and instantly distributes them across the ambient liquidity curve so that a user’s rewards are continuously compounding. The lack of dead capital means more capital efficiency and less gas impact on the user.

While the liquidity provision on CrocSwap is an improvement, I still haven’t mentioned what is being done to minimize JIT trading. CrocSwap applies a JIT threshold parameter to every concentrated LP position in a pool (JIT is impractical with ambient liquidity), and it can be turned on or off when the pool is created.

This JIT threshold parameter essentially works by setting a minimum time limit before which an LP cannot burn their position. The minimum time-to-live (TTL) is set at 0 to 255 seconds. Whatever the TTL is set to, any concentrated LP will have to wait the duration of this time before they can exit their LP position. Hence, when this threshold is turned on it is virtually impossible to conduct a JIT trade.

However, setting an arbitrary TTL can be problematic because you will always have special cases. Therefore, the additional measure of protocol gating is instituted. This allows the threshold to be adjusted for specific pools by governance, and also allows governance to temporarily set the TTL to 0 – or any other limit –for whitelisted addresses. When participants believe JIT will improve market quality and execution environments, they can adjust the parameters accordingly.

Bonus Features

The features described above simply show what’s been implemented to make improvements to gas efficiency and LP’ing since both these elements are at the core of a successful AMM. However, simply solving for those is not enough if you want to be the best.

Permissioned Pools

Permissioned pools have been a major point of innovation and controversy in the past. While it does go against the inclusionary, opt-in ethos of crypto, having them as an option within the DEX opens up a new set of potential use cases.

Permissioned pools work by a permit oracle. This oracle can either be controlled by CrocSwap governance or controlled externally, but CrocSwap governance has to approve every permit oracle. The permit oracle will have a specific set of data that it interfaces with to determine the parameters for gating entry into the pool. This data includes:

  • User Address
  • Base and Quote Token Address
  • Type of Action Being Performed (Swap, Mint, Burn, or Compound)

Permissioned pools can be used for whitelistings, where users go through a whitelisting process and only the whitelisted users can participate in those pools. It is a popular product for traditional institutions who are not comfortable putting their money in permissionless DeFi right now. Another potential use case is sponsored pools, where anyone can stake liquidity in the pool but only specific users can swap tokens against the pools.

There are many more potential use cases for permissioned pool, but the important takeaway is that simply having it as an option adds to the versatility of the DEX.

Long Form Order Directives

The core function of any AMM is to allow users to perform a certain set of tradeable actions. CrocSwap divides these tradable actions into 5 core primitives:

  • Swap
  • Mint Range
  • Burn Range
  • Mint Ambient
  • Burn Ambient

A long form order directive is a function which allows users to encode an action by sequencing any of these core primitives in any order they want, which can be used across any pool in the DEX. This allows for sophisticated participants to perform extremely complex strategies through one simple transaction over which they have complete control of customization.

Performing such tasks in previous DEX’s was never possible due to the gas load. On a single smart contract DEX like CrocSwap, this is now much easier.

Oracles

Unlike other DEX’s, CrocSwap does not have a historical price oracle. Typically, the storage cost of historical price oracles is imposed on the users through gas fees, so it is omitted on CrocSwap. Instead, their single smart contract architecture allows for batching snapshots of price oracles from different pools at a relatively low cost.

Conclusion

CrocSwap is making a bold attempt to drive the AMM space forward and nothing similar has been attempted. Through features like customizability and complexity of executable strategies, they truly have the potential to propel AMMs to the next level. Traveling to unchartered territory presents great risks, but also allows users to reap greater rewards. If there is anyone who can potentially challenge the Uniswap hegemony, CrocSwap is certainly amongst the top competitors.

Published on Aug 15 2022

Written By:

Leftside Emiri

Leftside Emiri

@LeftsideEmiri
newo-logo

Copyright © 2024 NEW ORDER. All Rights Reserved

Privacy PolicyToken Terms and Conditions