# Elastic Automated Market Maker (eAMM)

The Automated Market Maker (AMM) plays the role of a central counterparty on DeFi protocols, allowing assets to be traded in a permissionless and instant manner by using liquidity pools .

On NAVAIX, the AMM model and the Constant Product Formula `(x * y = k)` are the core of price discovery. However, NAVAIX uses a novel approach known as the Elastic AMM (eAMM), modeled after algorithmic stablecoin protocols' efforts to keep their peg by using on-chain algorithms that increase or decrease supply according to market conditions. The eAMM provides a spot-like trading experience and significantly improves capital efficiency by allowing single-asset provision as the *BASE* asset while synthesizing the *QUOTE* asset.

NAVAIX uses a simple `x * y = k` equation to set the mathematical relationship between the particular assets held in the liquidity pools. The eAMM pool is composed of two types of assets. One is the *BASE* asset (i.e. BTC, ETH, LINK, etc.), while the other is the *QUOTE* asset (i.e. USDC) that is dynamically supplied.

#### <mark style="color:red;">Example</mark> <a href="#example" id="example"></a>

Let’s assume that the liquidity provider provides 5,000 ETH to the pool, and the ETH price quoted in USDC equals 2,000.

In this case, eAMM will dynamically supply 10,000,000 virtual USDC coins (`5,000 * 2,000`). The constant, `k`, in the aforementioned `x * y = k` equation will be 50,000,000,000 (`5,000 * 10,000,000`).

1. Alice decides to open a long position worth 2 ETH with 5x leverage. Alice adds 2 ETH to the margin contract and 20,000 USDC will be traded with eAMM accordingly (`2 * 5 * 2,000`). In this case, Alice will receive 9.98 ETH (0.1% trading fees excluded for calculation purposes). `5,000 - [50,000,000,000 / (10,000,000 + 20,000)] = 9.98` Alice's long position will be recorded as 11.98 ETH and -20,000 USDC. The amount of ETH and virtual USDC coins within the AMM becomes 4,990.02 ETH and 10,020,000 USDC.
2. Bob then decides to open a short position worth 1 ETH with 2.5x leverage. Bob adds 1 ETH to the margin contract and 5,000 USDC will be traded with eAMM accordingly (`2,000 * 2.5 * 1`). In this case, Bob will pay 2.4913 ETH. `[50,000,000,000 / (10,020,000 - 5,000)] - 4,990.02 = 2.49` Bob’s short position will be recorded as -1.4913 ETH and 5,000 USDC. The amount of ETH and virtual USDC coins within the AMM is 4,992.51 ETH and 10,015,000 USDC.
3. Assume that the spot prices of ETH quoted in USDC on other DEX pools are equal to 2,040. The spot price of ETH quoted in USDC on ApeX is currently 2,006 (`10,015,000/4,992.51`), which deviates by more than 1% from the spot prices on other DEX pools. In this case, the rebase mechanism will be triggered. ApeX will supply virtual USDC coins dynamically to 10,184,723 (`4,992.51 * 2,040`) so that the spot prices in the pool remain anchored to the spot prices on other DEX pools.
4. Assume that Alice decides to close her long position recorded as 11.98 ETH and -20,000 USDC. In this case, 20,000 USDC will be removed by eAMM. The number of ETH and virtual USDC coins in the pool becomes 5,002.33 (`4,992.51 * 10,184,723 / 10,164,723`) and 10,164,723 (`10,184,723 - 20,000`), respectively. As a result, Alice will pay 9.8232 ETH (`5,002.33 - 4,992.51`). She will earn a total of 0.1568 ETH (`9.98 - 9.8232`) after closing her long position.
5. Assume that Bob then decides to close his short position recorded as -1.4913 ETH and 5,000 USDC. In this case, 5,000 USDC will be supplied by eAMM. The number of ETH and virtual USDC coins in the pool becomes 4,999.88 (`5,002.33 * 10,164.723 / 101,697,23`) and 10,169,723 (`10,164.723 + 5,000`), respectively. As a result, Bob will lose a total of 0.0413 ETH (`5,002.33-4,999.88 - 1.4913 -1`) after closing his short position.

![](https://abcxyz12312312ss.gitbook.io/~gitbook/image?url=https%3A%2F%2F1575213325-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F1tGGxa8yekawHc2dqMa0%252Fuploads%252FFqwZyWtz4finEMBIF7gM%252Fimage.png%3Falt%3Dmedia%26token%3D01a58b36-f38c-4e95-8da8-b36b22a3e2e4\&width=768\&dpr=4\&quality=100\&sign=4dcff3590031732d9ab35507663eef49980fa92bc668ce8915f246a9b47da96d)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://whitepaperfinance.gitbook.io/navaix-whitepaper/navaix-dex/navaix-trading-perpetual/elastic-automated-market-maker-eamm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
