Clipper DEX’s Recent Upgrades

Clipper DEX’s Recent Upgrades

We recently deployed a new set of smart contracts across all of the chains that Clipper sails. These structural upgrades have been in the works for quite some time and include new features that improve the trading and liquidity provision experience for all our DeFi pirates!

How Do These Upgrades Affect Clipper Users on Mainnet?

Clipper’s recent upgrades offer three main user benefits:

  • Lower gas costs: Clipper’s new mainnet architecture is more gas efficient. Clipper now substantially outperforms UniswapV3 in gas use on swaps, meaning it easily re-takes the title of the best place to do small swaps on Mainnet!
  • Broader price optimization: Clipper’s new architecture is more capital efficient. Mainnet Clipper is now designed to have the lowest trade prices on trades of up to $50k in value (rather than up to $10k).
  • Smoother deposits and withdrawals: Clipper now supports gas-optimized deposits and withdrawals of single assets, including native tokens. In other words, Clipper’s liquidity providers can now deposit and withdraw ETH on Mainnet without having to deal with wrapped tokens.


An Evolution of DEX Architecture

Clipper’s original mainnet AMM architecture was replaced with a new FMM (Formula Market Maker), which we initially piloted on Polygon and which is similar to an RFQ model with a few important differences. In the past, RFQ designs have been closely tied to hedge fund traders and institutional market makers, and have generally run on proprietary, closed-source logic. By contrast, Clipper’s FMM design is the first that allows retail traders to participate and deposit liquidity on-chain with logic sourced from a publicly disclosed and verifiable formula that could itself be onchain or offchain. Furthermore, traditional RFQ architectures can revert rates, meaning hedge funds traders will oftentimes renege on offers that have already been made. This goes against everything Clipper stands for. Clipper’s FMM architecture never reneges on a quote because of external factors the way too many major legacy trading firms can and do.

Clipper’s new FMM architecture was audited by Solidified, and the architecture transition was designed to be seamless from a user perspective. As part of this new contract redeployment process, we first had to disable swaps on Clipper’s v1 mainnet. We were able to migrate the institutional liquidity from our initial financing round, but aren’t able to do so for the community’s liquidity because we don’t have any control over those funds by design. From there, trading recommenced on Clipper v2 under more cost-efficient conditions. We encourage community LPs to migrate their liquidity as soon as it unlocks.

Improved Gas Use on Mainnet

We know that the run-up in transaction costs on Ethereum Mainnet following last July’s London Hardfork has been painful for crews around the world. In response, Clipper’s FMM contracts were painstakingly re-implemented to optimize gas use on mainnet.

We put Clipper to the test against the most popular DEX, UniswapV3, trading the most popular swap, ETH to USDC, and we were amazed by the results. For an ETH to USDC swap for a trader with balances of both assets, Clipper used 94k gas while UniswapV3 used more than 120k - that means Clipper used about 25% less gas! Depending on the prevailing gas price winds, that difference in gas can mean $2 to $20 in savings per swap. That’s valuable booty staying in your treasure chest!

Improved Overall Deposit and Withdrawals

All of the contracts now support gas-optimized deposits of single assets, including the deposit of raw native token. Similarly, we’ve improved the single-asset withdrawal capabilities of the contract - you can now withdraw raw native token from the contract as well. So future LPs will be able to deposit and withdraw MATIC on Polygon, or ETH on Mainnet without worrying about wrapped tokens.

On-Chain Invariant Evaluations

Clipper’s FMM uses invariant-based pricing to price trades. However, one limitation that we have encountered is that our full family of invariant-based market makers that we developed in our white paper in general require some sophisticated numerical calculations (decimal powers). Solidity is good at many things but precise decimal math is not one of them!

We have now updated Moonbeam and Polygon to make use of the excellent PRB Math library to evaluate the market maker’s invariant function on-chain. As a result, those contracts will refuse to execute any transaction that would harm the market maker’s LPs by reducing its invariant. While most traders shouldn’t see any differences with Clipper after this change, it makes Clipper’s market maker substantially more resilient to “stuffing” or “sybil” attacks by malicious bots. This is an important security measure we’ve been working to implement for some time now and addresses a significant attack vector.

Clipper Mainnet CLP Updates

Clipper’s new architecture means that users who participated in Clipper’s original mainnet CLP in October 2021 will stop earning yield on their contributions, which they will not be able to withdraw until July 2022. Team has taken note of those impacted by this change.

Additionally, there will be a new Clipper Ethereum mainnet CLP for Clipper FMM, which will open shortly after contract deployment. All Clipper community members - including past LPs - will be eligible to participate.