BLOG — Use cases



61 days ago

Liquidity Management on Uniswap v3

Cetra Finance Use Case: Automatic Rebalancing


  • Active management of DeFi positions is a necessary and inevitable way of developing competitive investment opportunities

  • Cetra Finance combines the biggest building blocks of DeFi: AMMs, DEXes and lending protocols to bring institution-like market making on-chain

  • Gelato Automate controls the rebalancing of Cetra’s delta-neutral chambers: moves the UniV3 range to always cover collateral, active price and swap funds between pools, and to borrow to ensure proper hedging, liquidation protection, and effective capital usage

AMMs and CLMMs

The Automated Market Makers (AMMs) bonding curve design has become a time-proven standard of DeFi market-making. With years of iterations, it has emerged as a robust, reliable, and capital-efficient way of creating liquidity sources in a permissionless manner.

But don’t let the name confuse you: “automated” doesn’t mean you can look away entirely. It’s automated in a very special sense — trade price and slippage are calculated by a predefined formula that is mainly dependent on pool reserves and swap amounts.

The Concentrated Liquidity Market Makers (CLMM) mechanism is the evolution of AMMs, popularized by Uniswap v3. While the main concepts intuitively follow AMMs, things have become even less automated for investors (liquidity providers). The ability to manage the liquidity range gave us a big strength of leveraging liquidity to receive relatively more fees, but imposed responsibility of watchful tracking positions not only to handle increased impermanent loss but to receive any fees.

The Problems

  • The first and most understandable problem is market risk. You can invest tokens in a 3-digit APR liquidity pool and leave with less in USD terms because of the price fall of the underlying tokens.

  • The second is the complexity and even expense of providing liquidity into CLMM pools: not only do you need to regularly make range-adjusting transactions, but also to decide what is the suitable range.

  • The third and the most specific is impermanent loss management. The most widespread hedging instruments in DeFi: perpetual futures and borrowing protocols, have linear payoffs. However, impermanent loss has a non-linear nature and cannot be perfectly hedged. That forces anyone who wants to control it to hedge the risk actively, readjusting the amount of hedging exposure with the change of underlying asset prices.

Existing Solutions

The most obvious way of managing mentioned LP risks is to implement all calculation logic privately, and execute rebalancing manually or use custom scripts to call needed contracts. This method is frequently used by DeFi asset management funds and might be acceptable for CeDeFi companies.

However, there is a growing amount of DeFi asset management projects using decentralized protocols with automated task execution functionality.

Cetra Finance Use Case

Cetra is an open-source Market-Neutral Market Maker protocol that allows users to provide liquidity in Uniswap V3 pools with deposits and yield nominated in USD stablecoins.

Strategies’ contracts deposit stablecoin as collateral to Aave and borrow needed volatile tokens to be locked as liquidity.

Liquidity range, Loan-To-Value (LTV) ratio, and hedge are then tracked and managed by Gelato.

Deposit Flow and Overall Structure

As said before, only the lending protocol and UniV3 pool are used. Strategies’ math is coded in the contract to have all the cash flows in the right proportion concerning liquidity range, LTV, and current hedge deviation.

Gelato Automate

That’s how Cetra Gelato-fies all the position management on an example of a pool with one volatile token (WETH/USDC).

  • The main rebalance function has no call restrictions, as rebalancing is always welcome if the needed conditions are met.

  • function performUpkeep(bytes calldata /* performData */) external override { (bool upkeepNeeded, ) = checkUpkeep(""); if (!upkeepNeeded) { revert ChamberV1__UpkeepNotNeeded(); } rebalance(); }

  • Checker for rebalance conditions: `function checkUpkeep( bytes memory /* checkData / ) public view override returns (bool upkeepNeeded, bytes memory / performData */) { { (uint256 tokenPool, ) = calculateCurrentPoolReserves(); if (tokenPool == 0) { return (true, "0x0"); } }

      uint256 _currentLTV = currentLTV();
      uint256 _currentHedgeDev = currentHedgeDev();
      upkeepNeeded =
          (_currentLTV >= s_maxLTV ||
              _currentLTV <= s_minLTV ||
              _currentHedgeDev > s_hedgeDev) &&
          (s_totalShares != 0);
      return (upkeepNeeded, "0x0");}`

In the current design, the checker and executable functions are essentially the same thing, as the last can be called only when the first allows it.


Web3 and especially DeFi are created with trustlessness and transparency at its heart.

Cetra shows how complex financial strategies traditionally associated with managers’ personal involvement can be implemented in a robust, reliable, and efficient way with the use of Gelato’s automation service.

Learn more about Cetra Finance:






· Cetra Finance