vAMM Explained

TL;DR: The Virtual AMM (VAMM) is XCCY's trading engine. It uses concentrated liquidity to discover fair Fixed Yield rates and execute trades between FY and VY positions.

What is a VAMM?

A Virtual AMM (VAMM) is an AMM that exists purely for price discovery — it doesn't hold actual assets.

Traditional AMM:                    VAMM:
━━━━━━━━━━━━━━━━                    ━━━━━━
                                    
┌────────────┐                    ┌────────────┐
│   Pool     │                    │   VAMM     │
│  Holds:    │                    │  Tracks:   │
│  - Token A │                    │  - Price   │
│  - Token B │                    │  - Ticks   │
└────────────┘                    │  - Liquidity│
                                  └────────────┘


                                  ┌────────────┐
                                  │ Collateral │
                                  │  Engine    │
                                  │ Holds all  │
                                  │   funds    │
                                  └────────────┘

Key Insight: The VAMM handles pricing; CollateralEngine handles money.

Fixed Yield Price Discovery

The VAMM discovers fair Fixed Yield rates through supply and demand:

How Ticks Encode FY

Like Uniswap v3, XCCY uses ticks to represent prices:

Tick Spacing

Pools define how granular FY rates can be:

Tick Spacing
FY Precision
Use Case

1

~0.01%

High precision markets

10

~0.1%

Standard markets

60

~0.6%

Gas-optimized markets

Concentrated Liquidity

LPs provide liquidity at specific FY ranges, not across all possible rates.

LP Position Example

Swap Mechanics

Opening an FY Position (Lock Fixed Yield)

What happens:

  1. User wants to lock FY

  2. VAMM matches against LP liquidity

  3. Price (FY rate) moves based on trade size

  4. Position is recorded with fixed/variable token balances

Opening a VY Position (Trade Variable Yield)

What happens:

  1. User wants VY exposure

  2. VAMM matches against LP liquidity

  3. Price (FY rate) moves based on trade size

  4. Position is recorded with opposite fixed/variable token balances

Internal Accounting

Fixed and Variable Token Balances

Positions are tracked using "notional" tokens:

Token Type
Represents
Sign Convention

Fixed Token

FY leg of the swap

+ = Receive FY, - = Pay FY

Variable Token

VY leg of the swap

+ = Receive VY, - = Pay VY

Example: FY Position

VAMM State

Each pool maintains state:

Reading Current FY

Fees

Trades incur fees that go to LPs:

Fee Calculation

Pool Key Structure

Each pool is uniquely identified:

Pool ID

VAMMManager Functions

Function
Purpose

createPool()

Deploy new IRS market

swap()

Execute FY/VY trade

mint()

Add LP liquidity

burn()

Remove LP liquidity

getVAMMState()

Read current tick/price

computeGrowthInside()

Get LP fee/token growth

Integration Example

Key Takeaways

  1. VAMM is for pricing, not custody — CollateralEngine holds funds

  2. Ticks encode FY rates — FY = 1.0001^tick

  3. Concentrated liquidity — LPs provide at specific FY ranges

  4. Negative amount = FY position — Sign determines direction

  5. Fees go to LPs — Proportional to active liquidity

Next Steps

  • Collateral Engine — Position and margin management

  • Provide Liquidity — Become an LP

  • API Reference — Full function reference

Last updated