Ambient pricing is dynamic liquidity fees plus route-dependent gas
Ambient pricing is the full swap cost produced by a pool’s dynamic liquidity fee, route-specific price impact and the gas required to settle that route. The quoted rate matters per hop: a direct trade pays one pool, while a multihop trade pays every pool in its path. A useful comparison converts gas into the output token and subtracts both fees and price impact from expected output. That makes single-hop and multihop quotes comparable on one net-received basis.
A 60-minute policy cycle makes dynamic fees notable
A 60-minute observation cycle lets Ambient’s policy oracle reassess each pool’s liquidity fee and align the quoted rate with recent in-range liquidity returns on Uniswap V3.
That model is notable because one Ambient pool changes its fee without splitting the pair across several permanent tiers. Lower fees improve trader execution when order flow is calm. Higher fees increase compensation to active liquidity providers when rapid price movement makes that liquidity more costly to supply. The oracle changes a pool parameter; it does not alter the CrocSwapDex contract code. A quote therefore needs the fee observed for the planned block, not a remembered rate from an earlier trade. A route recalculation after the 60-minute boundary can legitimately return a different fee even when token quantities stay unchanged.
Ambient’s standard pool type uses index 420, yet the fee remains a changeable parameter of that pool type. CrocQuery exposes pool state for quote construction, while CrocImpact estimates price movement from a proposed swap.
Fee ceilings and atomic recovery protect the quote
Three swap controls - the 16-bit tip, 128-bit minimum output and 128- bit limit price - bound a quoted execution before CrocSwapDex commits token flows to final contract storage for safe settlement.
The tip field is a fee ceiling, despite its name. A zero value accepts the pool’s standard rate; a nonzero value records the maximum liquidity fee that the caller accepts. The minOut field supplies whole-transaction protection: if execution breaches the minimum output or maximum input, the call reverts and state changes roll back atomically. The limitPrice field controls the curve boundary differently. Reaching it stops further filling and can leave part of the requested quantity unfilled. A quote should identify whether it assumes a complete fill, because a low fee does not compensate for an unintended partial fill.
| Parameter | Fixed encoding | Fallback or recovery standard |
|---|---|---|
| tip | Unsigned 16-bit ceiling; 0 accepts the pool rate | Reject execution above a nonzero ceiling |
| minOut | Unsigned 128-bit quantity bound | Revert the whole transaction when breached |
| limitPrice | Unsigned 128-bit Q64.64 square-root price | Stop at the boundary and permit a partial fill |
For an all-or-nothing comparison, minOut is the decisive control; limitPrice belongs to route logic that intentionally permits partial execution.
One hop and two hops create different cost stacks
One direct Ambient hop incurs one pool fee, one segment of price impact and one transaction gas bill, while a two-hop route incurs two pool fees.
Each pool charges its liquidity fee on the notional that crosses its curve. A protocol take, set to zero or encoded as a 1/n fraction, divides that fee between protocol governance and active liquidity providers. The LP portion accrues pro rata to the ambient and concentrated positions supplying active liquidity at execution.
A two-hop path contains two pools and one intermediate token; a three-hop path contains three pools and two intermediate tokens. Every pool contributes separate fee arithmetic and curve movement. Gas also rises because the contract executes another swap segment, although Ambient’s single-contract architecture keeps all pools inside CrocSwapDex.
Route length alone therefore ranks complexity, not value. A deep two-hop path can return more output than a thin direct pool, while a liquid direct pool avoids the second fee and extra computation.
When does a multihop route cost less?
Two pools in a multihop route beat one only when their combined output improvement exceeds both liquidity fees, added price impact and extra gas expressed in the output token.
Consider a USDC-to-DAI trade on Ethereum. A direct USDC/DAI pool gives one output estimate. A routed USDC/ETH/DAI path gives another, with native ETH acting as the intermediate asset because Ambient represents a chain’s native currency with the zero address. Both routes must use the same input amount and block context.
The quoter’s output already incorporates pool fees and price impact. Do not subtract those components twice. Net received equals quoted output minus the output-token value of network gas and any relayer tip. Compare that figure with the direct route’s net received. Refresh both routes together if the base fee, pool state or dynamic fee changes. A single hop wins when its lower execution overhead exceeds the multihop path’s liquidity advantage; the multihop path wins when deeper curves deliver a larger surplus after every cost.
A transparent two-hop calculation
Ten thousand USDC provides a clean two-hop illustration of how per-pool fees and a route’s gas budget combine into one effective execution cost for comparison.
In this hypothetical scenario, a USDC/DAI hop charges 0.05% and a DAI/USDT hop charges 0.30%, with 1:1 conversion and no price impact. The first fee is 5 USDC-equivalent, leaving 9 995. The second is 29.985, leaving 9 965.015; combined liquidity-fee drag equals 34.985 or 0.34985%. A 180 000-gas transaction at 20 gwei costs 0.0036 ETH. Using the scenario’s 2 500-USDC ETH conversion makes gas 9 USDC-equivalent. Total route cost is 43.985, net output is 9 956.015 and effective cost is 0.43985%.
The calculation isolates the comparison method rather than predicting a live quote. Insert the displayed per-hop rates, estimated gas and quote-time ETH conversion; then compare the final net output with the direct pool.
Gas belongs in the output-token comparison
One gwei equals 1 000 000 000 wei, so an Ethereum gas estimate becomes a currency cost only after multiplying gas used by the effective fee per gas.
One ETH contains 10 18 wei. Under EIP-1559, the effective fee combines the block’s base fee with a priority fee, subject to the sender’s caps. The base fee adjusts by at most 12.5% per block, and the design uses a 2× elasticity multiplier around the gas target. Those constants do not determine the live fee; block demand supplies that input.
Route simulation supplies gas used. The Ambient cold path adds approximately 5 000 gas over the original hot-path logic because it reaches swap code through a proxy call. Ethereum and Scroll integrations use the userCmd call path rather than the deprecated direct swap path. On Scroll, Blast and Swell Chain, wallet estimates also reflect each network’s execution and data-fee model.
A higher raw token output can lose after gas conversion, particularly on a small trade. Compare output after network cost with the direct route, an aggregator quote and any relayed transaction fee.
Net settlement removes intermediate token transfers
One intermediate token links a two-hop path, yet Ambient’s net settlement records only the user’s aggregate debit and credit across CrocSwapDex for final transaction settlement.
The intermediate balance never needs a separate ERC-20 transfer between pools. That reduces transfer-related gas, but the second curve calculation and second liquidity fee remain. Direct wallet settlement still collects the input token and sends the final output token. Surplus collateral goes further: an 8-bit settlement flag uses 0x1 for the base side and 0x2 for the quote side, letting either side settle against an internal balance.
EIP-712 relayed execution changes who prepays network gas, not whether computation has a cost. The relayer submits the transaction and receives an optional token tip. Repeated traders can compare surplus settlement with direct ERC-20 settlement; the former replaces wallet transfers with internal balance updates, while the latter keeps assets in the wallet between swaps.
Fee precision and curve math under the hood
Sixteen fee bits, 24 signed tick bits and a Q64.64 square-root price give Ambient deterministic inputs for reproducing each per-hop quote on-chain without floating-point rounding.
Around that, Ambient stores pool liquidity fees as unsigned 16-bit integers with each unit equal to 0.0001%.
Pool type index 420 identifies the standard template, while pool indexes occupy 256 bits and token addresses occupy 160 bits. Raw swap quantities use signed or unsigned 128-bit integers, so clients must apply each ERC-20 token’s decimals before displaying human-readable amounts. Curve ticks map price through a 1.0001 ratio, making one tick a 0.01% price step before pool-specific tick spacing. Q64.64 devotes 64 bits to the integer portion and 64 bits to the fractional portion of the square-root price. CrocQuery returns these values without normalizing token decimals.
Exact integer handling matters most across multiple hops, where premature decimal rounding compounds. The protocol’s encodings provide the reproducible baseline; a floating-point screen estimate is the less reliable alternative.
Uniswap V3 tiers and aggregator quotes use different controls
Four canonical Uniswap V3 fee tiers - 0.01%, 0.05%, 0.30% and 1.00% - separate liquidity by pool, whereas Ambient changes the fee parameter within its chosen pool type for each pair.
That distinction changes quote interpretation. A Uniswap V3 route names a fixed-fee pool at every hop; an Ambient route needs the observed dynamic rate for each pool. Aggregators such as 1inch and 0x compare several venues and may split flow, while CoW Protocol uses solver competition around trade intents. Compare executable output, gas treatment, route count and settlement assumptions. A venue label alone does not reveal the lower net cost, so the decision belongs to simultaneous quotes for the same quantity.
A reproducible quote record
Five recorded fields make Ambient pricing comparable across refreshes: chain, block context, exact input, full route and output after all quoted pool fees and price impact.
- Record the chain and native gas asset, including Ethereum, Scroll, Blast or Swell Chain.
- Record token contract addresses and decimals; USDC uses 6 decimals, while DAI uses 18.
- Record every ordered pool, intermediate token and per-hop liquidity fee.
- Record expected output, minOut and any intentional limitPrice boundary.
- Record gas used, fee per gas, gas-token conversion and any EIP-712 relayer tip.
One stale field breaks the comparison. A new block can change base fee, pool reserves and curve price, while the 60-minute policy cycle can change a pool’s liquidity rate. Keep the direct and multihop observations together, then recompute net output in one denomination.
In that configuration, Ambient pricing becomes decision-ready when the selected route maximizes that net output under the same execution bounds. This record also makes a later transaction receipt comparable with the quote, rather than with an unrelated screen estimate.
Key questions about Ambient pricing
Do ERC-20 approvals count toward the cost of a first Ambient trade?
Yes. Selling an ERC-20 token through CrocSwapDex requires sufficient allowance, so a first trade can include a separate approval transaction and its gas cost. Receiving a token needs no approval. Later swaps reuse the remaining allowance until it changes, while input drawn from Ambient surplus collateral avoids another wallet transfer and approval check.
Why does a smaller Ambient trade show a larger gas percentage?
Gas work changes far less than trade notional, so dividing a similar native-network cost by a smaller token amount produces a larger percentage. Compare absolute gas after converting it into output tokens. A two-hop route that looks acceptable on a large USDC order can lose to one hop on a much smaller order.
Does an exact-output Ambient quote charge fees differently from exact-input?
No. The same per-pool liquidity rates apply, but the constrained side changes. An exact-input quote fixes what the trader spends and calculates output; an exact-output quote fixes what the trader receives and calculates required input. The maximum-input boundary must cover route fees and curve movement, while gas remains a separate network cost.
Are token decimals relevant when comparing Ambient route fees?
Yes. Ambient contracts handle raw 128-bit quantities, so clients must normalize each token before comparing human-readable output. USDC uses 6 decimals and DAI uses 18. The percentage fee remains the displayed rate, but applying the wrong decimal scale corrupts the quoted amount, minimum output and effective-cost calculation.
Does the priority fee change the Ambient exchange rate?
No. The priority fee pays for transaction inclusion and does not change the pool’s curve price, liquidity fee or deterministic swap math; it affects total execution cost, so two identical Ambient quotes with different priority fees produce the same token output but different net outcomes.
Who receives fees when ambient and concentrated liquidity share one pool?
The pool allocates the LP portion pro rata across liquidity that is active where the swap executes. Ambient liquidity remains active across the full curve, while a concentrated position earns only inside its chosen range. Any configured protocol take receives its encoded share first; the rest becomes liquidity rewards and compounds into ambient liquidity.
Last updated