# Mathematics of a Virtual Automated Market Maker (vAMM)

A virtual AMM, unlike traditional AMMs such as Uniswap, does not hold actual assets but simulates trading pairs and liquidity through mathematical formulas. The core of a vAMM can be understood through a Constant Product Formula, which is common in AMMs.

Let's consider a vAMM for a trading pair, say Asset A and Asset B. The constant product formula is:

Where:

Price determination in vAMM can be derived from this formula. The price of Asset A in terms of Asset B can be represented as:

This model allows a vAMM to simulate a trading environment without requiring actual asset pools.

#### Mathematics of Single-Asset Collateral Vaults

Single-Asset Collateral Vaults in decentralized finance are based on the concept of over-collateralization to ensure the system's stability. The basic formula to understand here is the Collateralization Ratio:

In the context of margin trading:

**Value of Collateral**: The market value of the single asset deposited by the trader.**Value of Debt**: The value of the assets the trader is exposed to through trading.

This ratio must be maintained above a certain threshold to avoid liquidation. For instance, if a platform requires a 150% collateralization ratio, it means that for every $100 worth of assets traded, the trader must have $150 in collateral.

#### Leverage Calculation

In margin trading, leverage is a critical concept. The leverage ratio determines how much a trader can borrow against their collateral. It is given by:

For example, with a leverage of 10x, a trader can take a position worth $1000 with $100 of collateral.

#### Risk and Liquidation

The risk associated with margin trading is quantified by the distance to the liquidation point. The liquidation occurs when the collateral value falls below the required collateralization ratio due to adverse price movements. Monitoring this risk involves constantly assessing the market value of collateral and the open position.

Last updated