Interpretation of Ambient Finance: an efficient two-way AMM protocol

Author: Web3 Research by Go2Mars

Ambient (formerly CrocSwap) is a decentralized exchange protocol that allows for a two-way AMM combining centralized and ambient constant product liquidity on any pair of blockchain assets. Ambient runs the entire DEX within a single smart contract, where a single AMM pool is a lightweight data structure rather than a standalone smart contract. This design makes Ambient the most efficient Ethereum-based DEX currently.

Interpretation of Ambient Finance: Combining the advantages of CEX and DEX, an efficient two-way AMM protocol

Mechanism Analysis

Automated Market Maker (AMM)

In Ambient, liquidity is provided through an Automated Market Maker (AMM) mechanism. Unlike traditional limit order books (LOBs), liquidity is not provided by individual orders, but by the aggregate liquidity of liquidity pools composed of funds provided by liquidity providers (LPs).

Each liquidity pool in Ambient represents a two-way market between a pair of fungible assets or tokens. At any given time, each liquidity pool has a single exchange rate determined by the virtual reserve ratio committed to that pool. End users can exchange one token of the pair for the other according to a deterministic formula.

Ambient liquidity pools use the Constant Product Market Maker (CPMM) algorithm. Regardless of the size or direction of the swap, the product of the two aspects of the virtual reserve will remain constant. (besides the fees charged and increased liquidity for concentration). When the exchanger sends a certain amount of base tokens to the pool, the liquidity pool will return a certain amount of quote tokens according to this constant product relationship. Therefore, the exchange rate of the liquidity pool will increase to increase the exchange rate of the quote token relative to the base token.

This mechanism balances supply and demand by readjusting prices proportionally according to the size and direction of the exchange. So instead of getting instant rates, swappers get slightly worse prices based on the size of their trades relative to the liquidity in the liquidity pool. This difference is called a price shock.

Additionally, swappers pay liquidity fees based on the notional amount they trade. Liquidity fees are redistributed to LPs based on the proportional contribution of active liquidity in the liquidity pool. Rates vary by specific liquidity pool and may be adjusted based on market conditions, but are usually in the range of 0-1%.

Centralized Liquidity

Centralized liquidity allows users to provide liquidity within any predefined price range on a single AMM curve. This is in stark contrast to Ambient liquidity, where liquidity remains active at all possible prices from zero to infinity.

The advantage of pooling liquidity is primarily capital efficiency. Liquidity Providers (LPs) only need to commit the collateral needed to support a limited range of liquidity. For example, a stablecoin pair trading between $0.99 and $1.01 would require significantly less capital to provide centralized liquidity.

The downside of pooling liquidity is that liquidity providers will no longer accrue fees if the curve price is out of order. Therefore, centralized liquidity providers either sensibly determine their price ranges, or periodically "rebalance" their orders, moving them back into ranges.

Ambient also supports native Ambient liquidity, which is different from "full-range centralized liquidity". The first advantage is that instead of accumulating fees in a separate side pocket, Ambient liquidity provider fees are automatically compounded back to their original positions without any manual management. The second advantage is that the gas costs required to mint and burn Ambient Liquidity Provider positions are significantly lower. A third advantage is that the positions of all Ambient liquidity providers on a given curve are naturally interchangeable and can be easily packaged into "LP tokens".

Elimination of Liquidity

Liquidity removal behaves the same as range-based pooled liquidity, except that liquidity is permanently removed from the AMM curve anytime the curve price crosses the edge of the range. When the curve price is lower than the buying price or the curve price rises to the selling price, it can be set to eliminate liquidity.

The act of weeding out liquidity is somewhat similar to an "irreversible limit order" in a traditional centralized limit order book. Users who want to achieve directional execution at a price better than the current market can buy (sell) in the pool by bidding (sell) below (above) the current price. As long as the price at a certain point exceeds that point, the user's order will be executed. Unlike the original centralized liquidity range order, even if the price rebounds past the filling price, the tokens purchased by the user will not be converted back. For this reason, staked liquidity is a useful tool for users who want directional execution but at a more favorable price than traditional swaps.

Elimination of liquidity orders offers better prices

  • Waiting for cheaper price
  • Receive rather than pay swaps
  • Avoid price slippage on the AMM curve

In practice, liquidation elimination tends to be somewhat limited by users

  • Unlike typical pooled liquidity, the width of the range order is fixed (usually narrow) across all knockout orders across the pool.
  • Knockout bids must always be lower than the current curve price, while knockout bids must be higher than the current curve price.
  • In order to be fully eliminated, the price must move completely within the entire range. If the curve moves to the middle of the range, the order may be "partially filled". If the price moves back into the range without reaching the knockout price, switch back.

Interpretation of Ambient Finance: Combining the advantages of CEX and DEX, an efficient two-way AMM protocol

User level

Token Swap

The core function of Ambient is to allow users to exchange one type of token for another at a fair market price. If there is liquidity for a given currency pair in the DEX contract, then users will be able to swap between tokens. In addition, front-end web applications provide interfaces for general-purpose exchanges.

Interpretation of Ambient Finance: Combining the advantages of CEX and DEX, an efficient two-way AMM protocol

Remaining Collateral

Users can directly deposit a certain amount of tokens in the DEX contract as a static balance. Excess collateral acts as lightweight working capital, so overhead and transaction costs are lower than handling ERC20 token transfers on every swap, mint, and burn operation. Excess collateral can be deposited by users directly by sending tokens directly into the DEX contract. Or it can be received as an output of a swap, burn, or harvest operation. In addition, the excess collateral can also be withdrawn directly, so that the user's wallet will receive the corresponding base token.

Governance & Policies

Governance of the Ambient Protocol is ultimately controlled by the DAO multi-signature. There are two main multisig authorities, operational multisig and financial multisig.

Capabilities for multisig operations include:

  • Set and modify pool parameters (e.g. liquidity fees, tick spacing, JIT thresholds, etc.)
  • Initialize the new pool type template
  • Set, turn on or turn off protocol fees
  • Set sub price size improvement token size threshold
  • Set a minimum liquidity commitment for newly initialized pool types.
  • Install a policy oracle pipeline with any functionality for manipulating multisig.

Treasury multisig is reserved for more serious administrative actions. However, this requires a higher level of commitment and longer delays. Treasury multisig combines a Gnosis safe with a 5-day timelock. In addition to standard operational multisig permissions, treasury multisig can:

  • Upgrade the code in the DEX contract
  • Transfer the authority of DEX to the new policy controller contract
  • Collect accumulated protocol fees in DEX
  • Force uninstall policy oracle before policy oracle expires
  • Force conversion of permissioned pools to permissionless pools (in case of misbehaving permission oracles)

System Overview

Interpretation of Ambient Finance: Combining the advantages of CEX and DEX, an efficient two-way AMM protocol

Governance fills the traditional role of a DAO. It has full power over the protocol and is controlled by an M-of-N multi-signature and timelock solution.

Strategy is the middle layer that sits between DAO governance and the DEX contract itself. It can directly deliver solutions from the governance layer, or delegate the limited administrative control of the DEX to an external smart contract policy oracle explicitly installed by the DAO governance.

Mechanism is the underlying DEX contract itself. CrocSwapDex (the core smart contract that holds decentralized liquidity and positions) is built with adjustable parameters that can be dynamically adjusted by an external policy oracle. This allows the protocol to improve and experiment with new features in a way that is safer and more controllable than directly upgrading the underlying DEX smart contracts.

Advantage

Ambient is a brand new codebase that takes into account best engineering practices and innovative smart contract architecture choices. This gives it some core advantages over other DEXs:

  • Significant savings in gas fees.
  • Combine concentrated ("UniV3 style"), ambient ("UniV3 style") and knockout liquidity (behaving like a limit order that atomically fills and locks a position in a single direction) on the same liquidity curve .
  • Dynamically adjusted pool fees to maximize returns to liquidity providers relative to market conditions and demand for liquidity.
  • Since fees from centralized liquidity providers are automatically reinvested into ambient liquidity, users can earn compound interest even without manual harvesting.
  • Prevent instant liquidity attacks by using minimum TTL parameters on centralized liquidity positions. As a result, regular liquidity providers can earn higher fees.
  • Users can pre-fund tokens on the DEX in the form of "residual collateral". Active traders are more efficient by delaying token transfers until net settlement.
  • Through the EIP-712 off-chain standard, users can conduct "gas-free" transactions with exchanged tokens.
  • Unique support for the "Limited Permission Pool" primitive, which offloads the ability to manage and limit pools to general-purpose smart contract oracles running inside or outside the protocol.

Summary

Interpretation of Ambient Finance: Combining the advantages of CEX and DEX, an efficient two-way AMM protocol

The liquidity provision model in Ambient combines the characteristics of decentralized exchanges and centralized exchanges. And unlike other AMMs, liquidity is not fragmented for trading pairs. Ambient can also run the entire DEX system in a single smart contract, thus achieving lower transaction fees, greater liquidity rewards, and a fairer trading experience. As a trading protocol that combines the characteristics of CEX and DEX, Ambient introduces novel DeFi native functions to bring users a first-class experience.

View Original
The content is for reference only, not a solicitation or offer. No investment, tax, or legal advice provided. See Disclaimer for more risks disclosure.
  • Reward
  • Comment
  • Share
Comment
0/400
No comments
Trade Crypto Anywhere Anytime
qrCode
Scan to download Gate app
Community
English
  • 简体中文
  • English
  • Tiếng Việt
  • 繁體中文
  • Español
  • Русский
  • Français (Afrique)
  • Português (Portugal)
  • Bahasa Indonesia
  • 日本語
  • بالعربية
  • Українська
  • Português (Brasil)