Ambient

Ambient is a single-contract AMM with three liquidity modes

Ambient is a decentralized exchange where an automated market maker prices token trades and liquidity providers supply the reserves that enable them. Its defining design places every pool inside one CrocSwapDex contract and lets three liquidity modes share a constant-product curve: full-range ambient liquidity, price-banded concentrated liquidity and one-direction knockout liquidity. Traders use it for EVM token swaps, while liquidity providers choose between broad exposure, capital efficiency and price-triggered execution. The protocol operates through deployments listed for Ethereum, Scroll, Blast and Swell. This article explains the fee stack first, then position choices, setup, trade-offs, alternatives and the contract mechanics that connect them.

What determines Ambient’s trading and position costs?

A pool’s encoded liquidity fee, the trade’s price impact and the network transaction charge together determine the cost of using Ambient (detailed in Ambient walkthrough ).

Liquidity fee encoding

The pool policy sets the percentage charged on each swap, and active liquidity receives that fee in proportion to its contribution. Ambient encodes pool liquidity fees as unsigned 16-bit integers, with each unit equal to 0.0001% of traded notional. This fixed precision supports changing fee settings without changing the underlying arithmetic. Full-range liquidity stays active, while concentrated and knockout positions collect fees only when their ranges participate in the current curve.

Price impact and routing

Price impact comes from trade size relative to virtual reserves, not from the encoded fee. A single hop uses one pool. A two-hop route crosses two pools, so both liquidity conditions and pool fees affect output. Ambient’s router selects a path off-chain, then the contract executes it on-chain. A slippage limit sets the worst acceptable result and reverts execution beyond that boundary.

Network transactions

Network gas is paid for each on-chain action. An ERC-20 input without an existing allowance normally adds one approval transaction before the swap, while native ETH reaches CrocSwapDex without WETH. Surplus collateral keeps a balance inside the contract and reduces repeated token transfers for active users.

For one worked example, use these hypothetical inputs: virtual reserves of 1 000 000 USDC and 1 000 000 DAI, a 10 000 USDC exact-input swap, a 0.30% pool fee and 4 USDC of network gas. The fee equals 30 USDC, leaving 9 970 USDC for the constant-product calculation. The formula returns 9 871.58 DAI, while the wallet spends 10 004 USDC including gas. Price impact is already reflected in that output. A real quote should be judged by final output, required approvals and network gas at signing.

Three liquidity modes on one curve

The intended holding period and price view decide among Ambient’s three modes, which together contribute to one shared liquidity curve.

Ambient liquidity

Ambient liquidity supplies both assets across the full price range, so it remains active wherever the pool trades. Its composition shifts between the pair’s two tokens as swaps move the price. The position earns its pro rata share of pool fees without choosing lower and upper ticks. This mode reduces range-management work, though the LP still bears the economic effect of continuous rebalancing against a static two-asset holding.

Concentrated liquidity

Concentrated liquidity places capital between two tick boundaries. It contributes greater depth inside that interval than the same capital spread across the full curve, yet stops earning once price leaves the range. Accrued fees automatically become ambient liquidity inside the same pool, so those earnings keep working across the curve. Repositioning combines a burn, swap and mint into one transaction.

Knockout liquidity

Knockout liquidity supports two directional forms: a bid below the current curve price or an ask above it. A complete traversal through the configured narrow range permanently removes the position from active liquidity and locks the converted asset. A partial traversal remains reversible until the far boundary is crossed. The contract interface defines four lifecycle actions - mint, burn, claim and recover - and recovery returns converted principal without the Merkle proof while giving up accumulated fees. Choose knockout only when directional execution matters more than continuous LP exposure.


Matching position type to the objective

The user’s objective decides whether Ambient functions as a swap venue, a passive two-token pool or a managed execution tool.

A swapper compares expected output, route length and the slippage boundary before signing. A liquidity provider seeking continuous participation selects ambient liquidity and accepts full-curve rebalancing. Narrower capital deployment calls for a concentrated range plus active monitoring. A patient directional order fits knockout liquidity because the position earns fees while in range and locks only after price crosses the complete band. These uses share one pool, but they create different inventory paths and exit actions.

The closest alternatives separate those choices differently. Uniswap V3 centers concentrated liquidity around pool-specific fee tiers. Curve uses StableSwap for assets expected to trade near one another. Balancer weighted pools support as many as 8 tokens, while 1inch aggregates routes across venues instead of supplying one shared LP architecture. Ambient stands apart through three modes on one curve and one contract. Venue selection still turns on pair liquidity, quoted output, desired inventory exposure and the cost of managing the position.


How do you start using Ambient?

A supported EVM wallet, the correct chain and a funded token pair are the three prerequisites for using Ambient through its interface.

Connect and select the market

The deployment registry lists four EVM environments: Ethereum, Scroll, Blast and Swell. Chain selection determines the gas asset, available pools and wallet network. An injected EVM wallet such as MetaMask or Rabby supplies the required signatures. After connecting, select the input token, output token and amount, then inspect the route. For LP activity, select the pair and choose ambient, concentrated or knockout liquidity before entering position parameters, as covered in Ambient pricing.

Authorize and submit

An ERC-20 input requires an approval or permit for CrocSwapDex. Without a prior allowance, the normal path contains two user actions: approval and swap. Native ETH instead travels in the transaction value and uses the zero address inside the protocol. Set either an exact input or exact output, then define the slippage boundary. The transaction settles only if the executed amount stays inside that limit.

Check the position and exit

Swap output settles to the wallet or surplus collateral. Ambient and concentrated positions remain until burned. A filled knockout leaves assets for a claim that also collects fees. Next decide whether lower transfer overhead justifies keeping working capital inside CrocSwapDex.

Contract, governance and market trade-offs

Position complexity and protocol concentration are the decisive trade-offs because Ambient combines market exposure, configurable policy and shared-contract execution in one system.

Every LP position exchanges stable inventory for fee income. Ambient and concentrated positions rebalance between two assets, so their value diverges from simply holding those assets as the price ratio moves. A concentrated position earns no fees outside its two ticks, while range selection and repositioning add transactions. A partial knockout traversal remains reversible, but a full traversal removes the position from the curve and requires a claim. Traders face price impact when order size consumes virtual reserves, and the slippage limit decides whether worsening execution settles or reverts.

Single-contract architecture concentrates pool state in CrocSwapDex, making shared code and administrative settings relevant across markets. Pool policy controls configurable fields such as liquidity fees, tick spacing and minimum commitment rules. Ambient separates governance across two Gnosis Safe authorities: an operations path behind a 12-hour timelock and a treasury path behind a 5-day timelock. Permissionless pools accept open participation, while permissioned pool types add an external oracle gate and require governance creation. Position scope, pool policy and contract concentration therefore belong in the same allocation decision.


How does Ambient’s single-contract AMM work under the hood?

One CrocSwapDex contract stores lightweight pools and applies shared swap, liquidity and settlement logic across each supported token pair on-chain.

Each pair contains exactly two fungible assets. Ambient represents token addresses with 160 bits and assigns the lower address as the base asset; a chain’s native currency uses the zero address. Pool types use 256-bit indices, with 420 designated for the standard pool type. Raw token quantities use signed or unsigned 128-bit integers. Curve prices use Q64.64 fixed-point square-root values, while signed 24-bit ticks map price through a base-1.0001 logarithm. These formats give every pool one deterministic ordering and one shared mathematical vocabulary.

Swaps follow constant-product logic across ambient reserves, with concentrated and knockout liquidity adding depth where their tick ranges are active. An 8-bit settlement field reserves 0x1 for base-side surplus collateral and 0x2 for quote-side surplus collateral. During a multihop route, the contract nets debits and credits across the DEX, so intermediate tokens do not require separate transfers. EIP-712 relayed operations add an off-chain signature path, while ordinary calls settle directly from the sender. The deciding user-facing inputs remain the available liquidity, final quote, position range and settlement destination.

Helpful answers about Ambient

Do I need WETH to trade native ETH on Ambient?

No. Ambient represents a chain’s native currency with the zero address and settles native ETH directly, so an Ethereum trade does not require WETH. ERC-20 tokens still use allowance and transfer mechanics. The wallet sends ETH through the transaction value, while excess ETH attached to an ETH-related operation returns to the sender.

What happens when a concentrated position moves outside its range?

An out-of-range concentrated position stops contributing active liquidity and stops earning swap fees until the market price returns between its lower and upper ticks. Its token composition has already shifted as price moved through the range. The owner may wait, remove the position or reposition it through a transaction that combines a burn, swap and mint.

Are Ambient LP positions represented by transferable ERC-20 tokens?

Ambient supports both native positions stored as lightweight entries in CrocSwapDex and ERC-20 LP tokens for ambient liquidity. Native storage uses less gas, while transferable tokens support integrations that need a tokenized claim. Concentrated positions and knockout positions follow their own position records, so users should not assume every liquidity mode produces the same transferable asset.

When do concentrated fees compound into ambient liquidity?

Fees earned by a concentrated position accrue into ambient liquidity inside the same pool, which keeps that fee-derived liquidity active across the full price curve. The original concentrated capital remains bounded by its selected ticks. This arrangement separates the narrow active range from the broader fee balance and removes the need to harvest solely to reinvest those earnings.

Who can initialize a new pool in Ambient?

The default Ambient pool type is permissionless, so any address may initialize a market for an arbitrary token pair if that pool does not yet exist. Initialization uses an existing pool type, sets the opening Q64.64 square-root price and permanently commits the configured minimum liquidity. Creating a new permissioned pool type remains a governance-controlled action.

Why does a fully filled knockout position require a claim?

A full crossing removes knockout liquidity from the active curve and locks the converted token balance, but the owner must claim that balance afterward. The standard claim also collects accumulated fees and uses a Merkle proof assembled from emitted events. A recovery path returns the converted underlying assets without the proof, though it forfeits the associated accumulated fees.

Which token becomes the base asset in an Ambient pair?

Ambient defines the token with the lower 160-bit address as the base asset, while the higher address becomes the quote asset; because a chain’s native currency uses the zero address, native ETH is always the base side in an Ethereum pair, giving every contract call and query deterministic ordering rules.

Last updated