# Introduction to Protocol

SyncSwap v1 is the first version of the exchange protocol released in 2023 during the early days of the zkSync Alpha Mainnet.

SyncSwap Protocol v2/v2.1 are iterations of the v1 protocol. V2 features security enhancements and a new pool type - Aqua Pool to achieve Concentrated Liquidity (CL).

## Changes in V2

### New Pool Type - Aqua Pool

Aqua Pool is a new pool model introduced in SyncSwap V2. There are only two pool models/types in V1 - Classic and Stable.

**Classic Pool** works like **Uniswap v2** pools, utilizing **x\*y=k** algorithm to support general tradings.

**Stable Pool** works like **Curve v1's Stableswap** pools, utilizing a hybrid curve to support stablecoin tradings.

**Aqua Pool** works like **Curve v2's twocrypto** pools, utilizing a dynamic hybrid curve with a built-in auto rebalancing mechanism to support volatile assets and LST assets tradings.

### Security Improvements

V2 Pools feature security improvements to solve some vulnerabilities like read-only reentrancy. It's audited by top security firms like Halborn, Zellic.

The V1 Pools remain working securely and processing most of the transactions, however V1 pools cannot be used for oracles.

## How SyncSwap Protocol works

{% hint style="success" %}
Deployed contract addresses can be found at <https://docs.syncswap.xyz/syncswap/smart-contracts/smart-contracts>
{% endhint %}

### Pool Factory

The liquidity pools can be created by corresponding pool factories of their pool type. There are three factories.

* SyncSwap Classic Pool Factory
* SyncSwap Stable Pool Factory
* SyncSwap Aqua Pool Factory

### Pool Master

Once a pool is created, the factory will register the pool with **Pool Master**. Pool Master works like a registry for pools and factories.

Pools of specific (2) tokens and types can be looked up via Pool Master.

### Fee Manager

**Fee Manager** contract stores default and custom swap fees of all pools. Fee Manager can be updated so it's not recommended to use a fixed address. You can get the latest fee manager contract address via functions in the **Pool Master.**

A **Fee Data** struct will be returned by querying the pool swap fee, it contains a min fee, max fee and a gamma variable.

* minFee - the current minimum fee of the pool
* maxFee - the current maximum fee of the pool
* gamma - a variable affects dynamic fee volatility, fees will be less volatile with higher gamma

Currently, **only Aqua Pool** supports dynamic fee, gamma is usually 0 for Stable and Classic Pools (minFee will be equal to maxFee if the fee is fixed)

{% hint style="info" %}
For backward compatibility, there is also a function to get the swap fee in uint256 directly instead of fee data, it's **deprecated** as Aqua Pool has dynamic fee enabled and gamma, min/max fees are required.
{% endhint %}


---

# 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://docs.syncswap.xyz/syncswap-technical-docs/integrations/introduction-to-protocol.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.
