Skip to main content

Pricing

Pricing in Rarity is not just about the last trade—it's about executable liquidity, manipulation resistance, and protocol-wide consistency. The CL AMM provides a focused set of pricing metrics essential for RWA tokenization: spot price for instant execution, TWAP for time-smoothed manipulation resistance, RWAP for depth-aware pricing that reflects true market capacity, and composite marks that combine these signals.

These metrics feed into every protocol product: lending LTVs, minting floor prices, and mark-to-truth auction triggers. The goal is straightforward: prices should reflect what you can actually trade at, not what someone claims they should be.

Design philosophy for RWA markets

Unlike high-frequency trading venues, RWA markets have distinct characteristics:

  • Slow-moving beliefs about value - Participants' views on asset worth change gradually
  • Thin liquidity - Lower trading volume than liquid crypto assets
  • Self-healing convergence - Mark-to-Truth auctions let participants act on value beliefs
  • Oracle-free design - The spot pool itself is the oracle

This means we focus on metrics that are:

  1. Computable on-chain without external oracles
  2. Manipulation-resistant even in thin markets
  3. Grounded in executable liquidity not theoretical midpoints
  4. Simple to maintain with minimal gas costs and attack surface

We deliberately exclude metrics like volatility feeds, toxic flow tracking, and high-frequency imbalance monitoring—those are for active trading markets, not asset-backed tokens where value beliefs move slowly.


Spot price

The spot price is the mid-price of the last trade—the current price at which the next infinitesimally small trade would execute. In a CL AMM, this is the price at the current tick, determined by the ratio of reserves in active liquidity ranges.

Purpose: Instant execution reference for small trades.

Limitations:

  • Thin liquidity: Spot price can be manipulated by large trades in thin markets
  • No depth information: Doesn't tell you how much liquidity exists at that price
  • Momentary spikes: Flash crashes or pumps can create misleading spot prices

Use cases:

  • Real-time trading interfaces
  • Instant swap execution for small amounts
  • Price charts and historical data

Why it's not enough: For protocol-critical functions like lending LTVs or liquidation triggers, spot price is too volatile and manipulable. This is why TWAP and RWAP exist.


TWAP (Time-Weighted Average Price)

TWAP smooths price over a time window by weighting each price observation by the duration it was active. This creates manipulation resistance because an attacker must sustain a manipulated price for the entire window to impact the TWAP significantly.

How it works

The protocol maintains a cumulative price accumulator that updates with every trade:

Accumulator(t)=Accumulator(t1)+ptΔt\text{Accumulator}(t) = \text{Accumulator}(t-1) + p_t \cdot \Delta t

To calculate TWAP over window [t0,t1][t_0, t_1]:

TWAP[t0,t1]=Accumulator(t1)Accumulator(t0)t1t0\text{TWAP}_{[t_0, t_1]} = \frac{\text{Accumulator}(t_1) - \text{Accumulator}(t_0)}{t_1 - t_0}

Example: Over a 1-hour window:

  • Price is $5,000 for 45 minutes
  • Price spikes to $5,500 for 5 minutes (manipulation attempt)
  • Price returns to $5,000 for 10 minutes
TWAP=5,000×45+5,500×5+5,000×1060=302,50060=5,042\text{TWAP} = \frac{5{,}000 \times 45 + 5{,}500 \times 5 + 5{,}000 \times 10}{60} = \frac{302{,}500}{60} = 5{,}042

The manipulation only moved TWAP by $42 (0.84%), despite a 10% spot price spike.

Window selection

Different protocol functions use different TWAP windows based on their manipulation risk and responsiveness needs:

FunctionWindowRationale
Lending LTVs30 minBalance manipulation resistance with market responsiveness
Liquidation triggers15 minFaster response to real price movements
Minting floor prices1 hourStrong manipulation resistance for supply management
Mark-to-Truth triggers4 hoursVery conservative, only triggers on sustained deviations

Trade-off: Longer windows provide stronger manipulation resistance but slower response to legitimate price changes. Shorter windows are more responsive but easier to manipulate.


RWAP (Realized Weighted Average Price)

RWAP captures the actual execution cost of trading through the current liquidity curve, weighting prices by the volume that would be executed at each level. This creates an impact-aware pricing metric that reflects true slippage and market capacity.

How it works

RWAP simulates the execution path through the current liquidity curve for a specific notional amount QQ, weighting prices by the volume executed at each level:

RWAPQ=ipiviivi\text{RWAP}_Q = \frac{\sum_{i} p_i \cdot v_i}{\sum_{i} v_i}

where pip_i is the execution price at level ii and viv_i is the volume executed at that level when trading through the curve.

Intuition: RWAP answers "What price would I actually pay to execute trade size QQ through the current liquidity?" by simulating the curve traversal and computing the volume-weighted average execution price.

Key point: RWAP is based on current liquidity depth, not historical trades. It's a forward-looking metric that reflects what the market can absorb right now for a specific size.

Impact-aware execution

RWAP captures slippage reality for large trades moving through multiple liquidity ranges.

Example: Current spot price is $5,000. To buy 100 tokens:

  • Range 1 ($5,000–$5,050): 50 tokens at avg $5,025
  • Range 2 ($5,050–$5,100): 30 tokens at avg $5,075
  • Range 3 ($5,100–$5,150): 20 tokens at avg $5,125
RWAP=50×5,025+30×5,075+20×5,125100=5,067\text{RWAP} = \frac{50 \times 5{,}025 + 30 \times 5{,}075 + 20 \times 5{,}125}{100} = 5{,}067

The realized execution price is $5,067, not the $5,000 spot price. RWAP captures slippage reality.

Manipulation resistance

RWAP is harder to manipulate than spot price because it reflects actual trade execution across multiple liquidity ranges. An attacker would need to:

  1. Execute large trades (expensive)
  2. Maintain manipulated prices across ranges (very expensive)
  3. Sustain this for the observation window (economically infeasible)

This makes RWAP ideal for fair-mark calculations and liquidation logic where execution cost matters.


Depth-aware price (Impact mid)

The depth-aware price measures what the market can actually absorb around the current spot by probing the AMM curve on both sides for a small, symmetric notional qq. It accounts for local liquidity thickness and slippage sensitivity, making it a highly manipulation-resistant mark.

How it works

  1. Choose a small notional qq (e.g., 5 bps of pool TVL)
  2. Simulate a buy of size +q+q and a sell of size q-q through the CL curve:
    • Pask(q)P_{\text{ask}}(q): price reached when swapping in +q+q stables
    • Pbid(q)P_{\text{bid}}(q): price reached when swapping out qq stables
  3. Take their midpoint:
Pdepth=Pask(q)+Pbid(q)2P_{\text{depth}} = \frac{P_{\text{ask}}(q) + P_{\text{bid}}(q)}{2}

This represents the impact-adjusted fair price at which a realistic, small trade could execute.

Example

If a ±$5,000 probe produces:

  • Pask(5,000)=1.023P_{\text{ask}}(5{,}000) = 1.023
  • Pbid(5,000)=0.979P_{\text{bid}}(5{,}000) = 0.979

then

Pdepth=1.001P_{\text{depth}} = 1.001

Uses

  • Oracle/mark price for lending, minting
  • Liquidity health indicator (thin pools have wider impact spreads)
  • Market-maker quoting - defines the "neutral" price to center liquidity bands

Limitations

  • Requires full tick-walk of liquidity (gas cost on-chain)
  • Choice of qq matters: too small → same as spot; too big → overstates slippage
  • Only captures local depth, not global market structure

Depth score

The Depth Score measures how much executable liquidity exists near the mid-price relative to a target depth DD^*.

DepthScore=min(Dbid,Dask)D\text{DepthScore} = \frac{\min(D_{\text{bid}}, D_{\text{ask}})}{D^*}

How it works

Sum bid- and ask-side liquidity within a chosen band (e.g., ±1%) around current mid. Take the smaller side and normalize by the protocol's target depth.

Example

  • Bid-side: $80,000
  • Ask-side: $100,000
  • Target depth: $120,000
DepthScore=80,000120,000=0.67\text{DepthScore} = \frac{80{,}000}{120{,}000} = 0.67

Uses

  • Risk scaling - Haircuts or collateral factors decrease when DepthScore < 1
  • MM rewards - Incentivize balanced, thick books
  • Circuit breakers - Suspend operations if depth collapses

Limitations

  • Snapshot metric—can fluctuate quickly
  • Does not capture distribution of depth across ticks
  • Requires tick scanning (moderate gas if done every block)

Guarded pool price

The guarded pool price combines multiple metrics to create a manipulation-resistant reference for supply management mechanisms:

pguard=max(ppool,TWAPN,RWAPQ)p_{\text{guard}} = \max(p_{\text{pool}}, \text{TWAP}_N, \text{RWAP}_Q)

Purpose: Ensure minting mechanisms never undercut the market by using a smoothed, depth-aware price floor.

How it works:

  • ppoolp_{\text{pool}}: Current spot price (immediate market reality)
  • TWAPN\text{TWAP}_N: Time-smoothed price over N minutes (manipulation resistance)
  • RWAPQ\text{RWAP}_Q: Depth-weighted price over Q quantity (capacity awareness)

Taking the maximum ensures that:

  1. New supply never enters below current spot price
  2. Manipulation attempts (temporary price drops) are ignored
  3. Thin liquidity (low RWAP) raises the floor

Example:

  • Spot price: $4,950 (momentary dip)
  • TWAP (30 min): $5,020 (smoothed)
  • RWAP (100 tokens): $5,000 (depth-aware)
pguard=max(4,950,5,020,5,000)=5,020p_{\text{guard}} = \max(4{,}950, 5{,}020, 5{,}000) = 5{,}020

Minting mechanisms use $5,020 as the floor, ignoring the momentary dip.


Off-chain computation and verification

Some metrics (particularly RWAP with large windows and depth-aware calculations) can be gas-intensive to compute on-chain for every transaction. The protocol supports hybrid computation models:

Oracle-based computation

Off-chain oracles can compute expensive metrics and submit them on-chain with:

  • Cryptographic attestations - Signed price feeds from trusted operators
  • Slashing mechanisms - Oracles stake collateral that can be slashed for incorrect submissions
  • Verification period - On-chain challenges allow disputing incorrect values
  • Fallback to on-chain - If oracle feeds are stale, compute directly on-chain

Future: Zero-knowledge proofs

Advanced implementations can use zk-SNARKs or zk-STARKs to provide:

  • Succinct proofs of correct metric calculation
  • Trustless verification - No need to trust the computation source
  • Gas efficiency - Verify proofs cheaper than computing metrics
  • Privacy preservation - Hide intermediate calculation details if needed

Current approach: All core metrics (spot, TWAP, guarded pool price) are computed purely on-chain. Depth-aware and extended RWAP calculations are available as view functions or oracle-submitted values with verification.


Essential metrics summary

For RWA tokenization, the protocol focuses on a pragmatic set of metrics that balance manipulation resistance, gas efficiency, and executable liquidity awareness.

Core price metrics (essential)

MetricDefinitionComputedPrimary UseOn-chain?
Spot PriceCurrent tick mid-priceNativeTrading UI, execution, mark inputs
TWAPTime-weighted average (N minutes)AccumulatorLending LTVs, mark-to-truth triggers
RWAPRealized weighted average (depth)SimulatedFair mark, minting, liquidations✅ View
Depth-Aware PriceImpact mid (±q probe)Tick-walkOracle-grade mark, local liquidity✅ View
Guarded Pool Pricemax(Spot, TWAP, RWAP)CompositeMinting floor, supply discipline
Depth Scoremin(D_bid, D_ask) / D*Liquidity sumRisk scaling, circuit breakers

Why these metrics?

Spot Price: Foundation of all other metrics; required for execution.

TWAP: Cheapest, most robust manipulation resistance; native accumulator in CL AMMs.

RWAP: Captures true execution cost by simulating curve traversal for a specific notional. Grounded in current liquidity depth and actual slippage reality.

Depth-Aware Price: Local liquidity-adjusted mark using symmetric bid/ask probe; resistant to micro-tick manipulation.

Guarded Pool Price: Self-protecting composite that prevents minting below market by taking maximum of multiple price signals.

Depth Score: Simple health check; enables pause triggers when liquidity collapses below thresholds.

Metrics deliberately excluded

The following metrics are valuable for high-frequency trading venues but add unnecessary complexity for RWA markets:

VWAP (Volume-Weighted Average Price): Manipulable through wash trading; ignores untraded depth. RWAP provides better depth-awareness.

Volatility (σ): RWA fundamentals move slowly; mark-to-truth auctions handle large deviations. No need for dynamic volatility tracking.

Toxic Flow / Adverse Selection: Requires high-frequency trade data and adds oracle dependency. Unnecessary for asset-backed tokens where mark-to-truth auctions provide price discipline.

Imbalance Tracking: Useful for HFT fee optimization, but RWA pools are naturally imbalanced during minting phases. Not a risk signal in this context.

Impact Slope / LVR: Advanced LP analytics better handled off-chain. Protocol doesn't need these for core operations.

Liquidity Decay Monitoring: Mark-to-Truth auctions and depth score provide sufficient protection without historical depth tracking.

Implementation approach

LayerMetricComputedUsed ForNotes
ExecutionSpot PriceOn-chainTrading, UIInstant, manipulable
Temporal smoothingTWAP (15–60 min)On-chainRisk references, triggersNative accumulator
Depth realismRWAP (simulated)View/off-chainMarking, minting, liquidationDepth-aware cost
Local liquidityDepth-Aware PriceView/off-chainOracle-grade markAnti-manipulation
Supply disciplineGuarded Pool PriceOn-chain (composite)Mint/redeem floormax(spot, TWAP, RWAP)
Health controlDepth ScoreOn-chainPause / haircutsSimple liquidity monitor

On-chain availability and composability

All essential metrics are computed or queryable on-chain in real-time:

  • Accumulators: TWAP uses cumulative accumulators updated with every trade
  • View functions: RWAP and Depth-Aware Price computed as view functions (gas-free queries)
  • Liquidity snapshots: Depth metrics query current tick liquidity distribution
  • Configurable windows: Different lookback periods for different risk profiles
  • Gas-efficient storage: Optimized layout enables cheap metric reads

Composability: External protocols can query Rarity's pricing metrics, enabling:

  • Third-party lending markets to use manipulation-resistant RWA pricing
  • Aggregators to incorporate RWA assets into broader DeFi indices
  • Risk management tools to monitor RWA market health
  • Arbitrage bots to detect mispricings and facilitate mark-to-truth convergence

Price convergence: Mark-to-Truth backstop

While TWAP and RWAP provide manipulation-resistant pricing, they cannot prevent sustained mispricings where spot market price drifts from fair value. This is where mark-to-truth auctions come in.

The problem

Spot markets can become unreliable for many reasons:

  • Thin liquidity - Few trades, easy to manipulate
  • Death spirals - Cascading liquidations push price away from fundamentals
  • Stale information - Market hasn't incorporated developments
  • Manipulation - Attackers move price without economic justification

When spot price loses credibility, the protocol needs a capital-based mechanism to discover what assets are actually worth.

The solution: Capital-based price discovery

Mark-to-Truth auctions force price discovery by actually selling a sample of underlying assets:

  1. Trigger: Anyone can call for an auction when pool health is questionable (posting a bond)
  2. Sample: Protocol randomly selects a sample assets from the pool (homogeneous lots)
  3. Auction: Bidders put up real capital to buy these assets at uniform clearing price PP^*
  4. Statistics: Compute deviation Δ\Delta and standard error SESE from bid distribution
  5. Decide: Three outcomes based on Δ\Delta and SESE:
    • CONFIRM (healthy): Keep current mark, slash caller bond
    • RECENTER (mispriced): Reset pool mark to PP^*, refund caller
    • WIND-DOWN (systemic): Begin orderly liquidation of entire pool

Core principle: Truth should cost money. Only when participants deploy actual capital to buy actual assets should the system update its mark. Opinions, appraisals, and oracle feeds are "cheap talk"—mark-to-truth auctions require skin in the game.

Manipulation resistance: To fake a mark, attackers must:

  • Dominate auction clearing price (expensive—they own the assets)
  • Keep bid dispersion low (requires multiple coordinated bidders)
  • Also manipulate on-chain spot liquidity (double capital requirement)

If bid dispersion is too high (no market consensus), the auction result is voided (INCONCLUSIVE) and no price change occurs.

Why it works: The combination of economic penalties (caller loses money if pool is healthy), statistical confidence (SE determines validity), and capital deployment (bidders receive real assets) creates a robust, manipulation-resistant backstop for spot pricing.

See the Mark-to-Truth Auctions section for complete mechanics, economics, and parameters.


Pricing for protocol products

Different protocol products use different pricing metrics based on their risk profiles and responsiveness needs:

ProductMetricWindow / ParamPurposeRationale
Spot tradingSpot priceInstantImmediate executionReal-time market clearing
Lending LTVsTWAP30 minManipulation-resistant collateral valuationBalance safety with responsiveness
LiquidationsRWAPQ = sizeFair execution price for liquidatorsAccounts for actual slippage at size
Minting floorsGuarded poolReal-timeNever undercut live marketmax(spot, TWAP, RWAP) protects supply
Redemption ceilingDepth-Awareq = 5 bps TVLFair exit price during redemptionsAccounts for local liquidity
Mark-to-Truth triggersTWAP4 hoursOnly trigger on sustained deviationsAvoid false positives from volatility
Risk monitoringDepth Score±1% bandDetect liquidity collapsesSimple health check for circuit breakers

This layered pricing approach ensures that each product uses the most appropriate metric for its requirements—spot for execution, TWAP for manipulation resistance, RWAP and depth-aware for liquidity-aware marking, and guarded composites for supply management.


Why this matters

Pricing is the foundation of the entire protocol. For RWA tokenization, the challenge is unique: you need manipulation resistance in thin markets where traditional crypto pricing assumptions break down.

Get it wrong and you have:

  • Manipulation risk: Attackers exploit thin liquidity to trigger liquidations or game minting
  • Poor composability: Other protocols won't trust pricing from illiquid RWA markets
  • Unfair outcomes: Users get liquidated on momentary spikes; minting undercuts market makers
  • Death spiral risk: Cascading liquidations in thin markets with inadequate depth awareness

Get it right and you have:

  • Truthful pricing: Prices reflect executable liquidity, not theoretical midpoints
  • Manipulation resistance: TWAP, RWAP, and depth-aware metrics resist attacks even in thin books
  • Capital-based backstop: Mark-to-Truth auctions force price discovery through actual asset sales when spot markets fail
  • Protocol-wide trust: Pricing is verifiable, composable, and grounded in real on-chain liquidity
  • Gas efficiency: Essential-only metric set keeps transaction costs low

The RWA pricing advantage

By focusing on essential metrics only and grounding everything in executable liquidity, the protocol achieves:

  1. No external oracle risk - The pool itself is the oracle for day-to-day pricing
  2. Manipulation resistance - Multiple complementary metrics (spot, TWAP, RWAP, depth-aware)
  3. Capital-based backstop - Mark-to-Truth auctions force price discovery through actual asset sales
  4. Simplicity - Fewer metrics, less complexity, smaller attack surface
  5. Composability - Other protocols can trustlessly query RWA prices

The combination of spot price, TWAP, RWAP, depth-aware marking, guarded composites, and capital-based mark-to-truth backstops creates a robust pricing infrastructure specifically designed for tokenized real-world assets where traditional oracle approaches fail.