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:
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:
User wants to lock FY
VAMM matches against LP liquidity
Price (FY rate) moves based on trade size
Position is recorded with fixed/variable token balances
Opening a VY Position (Trade Variable Yield)
What happens:
User wants VY exposure
VAMM matches against LP liquidity
Price (FY rate) moves based on trade size
Position is recorded with opposite fixed/variable token balances
Internal Accounting
Fixed and Variable Token Balances
Positions are tracked using "notional" tokens:
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
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
VAMM is for pricing, not custody — CollateralEngine holds funds
Ticks encode FY rates — FY = 1.0001^tick
Concentrated liquidity — LPs provide at specific FY ranges
Negative amount = FY position — Sign determines direction
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

