# Dynamic AMM

The Merlin dAMM enables us to support a dual-state environment for liquidity operations on our platform. With this in mind, we have designed it to support a plethora of necessary functionality.&#x20;

Our architecture is at its core, a peer-to-peer system designed for exchanging Tokens present on the [ZkSync ERA Mainnet](https://explorer.zksync.io/).&#x20;

At the forefront of this is our commitment to ensuring a censorship resistance, secure and self-custodial home for lodging liquidity.

You can learn more about our technical implementation of both [Volatile](#merlins-support-of-volatile-amm-architecture) & [Stable](#merlins-support-of-stable-amm-architecture) AMM infrastructure at Merlin below.

<figure><img src="https://3248998111-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnVObPzq4yQ3FMBCdTt2E%2Fuploads%2FPxrKdgxg39meKYp9PUGZ%2Fmerlin-tokenomicsB.png?alt=media&#x26;token=82750f53-2835-4841-ac5e-9b1b22710268" alt=""><figcaption></figcaption></figure>

### Merlin's Support of Volatile AMM Architecture

Merlin implements a novel support of the creation of pair contracts for any two ERC20 standard tokens on ZkSync with best path routing handled on-chain. In doing so **we are able to support two core logic standards of pairing types**

*   **Volatile**:&#x20;

    $$
    x * y = k
    $$

    ###

_Volatile pairs are composed of uncorrelated assets, based on 'Constant Product Formula'._

#### Volatile AMM[​](https://docs.uniswap.org/concepts/uniswap-protocol#order-book-vs-amm) Overview <a href="#order-book-vs-amm" id="order-book-vs-amm"></a>

In summary, an AMM replaces the buy/sell orders present in traditional order book markets with a liquidity pool of two assets, both valued in a relative nature. As one asset is traded for the other, the relative prices of the two assets is adjusted, and a new market state is determined. In this dynamic, a buyer or seller trades directly with a given pool.&#x20;

Pairs act as automated market makers, constantly ready to accept one token for the other as long as the “constant product” formula is preserved. This formula is widely accepted as `x * y = k`, is defined by parameters (`k`) as constant of a pair’s reserve balances (`x` and `y`). Because `k` remains unchanged from the reference frame of a trade, it is often referred to as the invariant.&#x20;

###

### Merlin's Support of Stable AMM Architecture&#x20;

Merlin improves on the Volatile model by implementing pin-point liquidity, that is allocated within a dynamic and flexible price range. Effectively defined as a Stable Environment State

* **Stable:**&#x20;

&#x20;                                                             $$x^3y+y^3x=k$$





With this, if a liquidity provider chooses this pair type, their capital is concentrated to smaller price intervals than (0, ∞). [​](https://docs.uniswap.org/concepts/protocol/concentrated-liquidity#active-liquidity)

As the price of an asset rises or falls, it may exit dynamically, determined by price bounds that LPs have set in a position. When out of this range, fees will not be accrued. Similarly, when price moves in one direction, LPs gain more of the one asset as swappers demand the other, until their entire liquidity consists of only one asset. Importantly, LPs are free to create as many positions as they see fit, each with its own price interval which is achieved by Tick boundaries of 0.01% intervals.&#x20;

