📜AMM Model

Core concepts and swap mechanism of Mantis AMM

Mantis allows users to provide liquidity in single asset tokens. Instead of depositing multiple pool pairs, liquidity providers only have to deposit one token. Like other single-sided AMMs, Mantis uses the concept of Asset Liability Management (ALM) to maintain accounts of each token to record assets and liabilities, a concept inspired from traditional finance. This design is what allows single-sided liquidity provision.

On top of ALM, MantisSwap uses the concept of liquidity ratio and its implementation to price an asset instead of the number of tokens as traditional AMMs do. Liquidity ratio is defined as the ratio of assets in the pool to the liabilities which the protocol has to pay back to its LPs.

Liquidity Ratio=Asset in PoolsDeposits made by LPs in poolsLiquidity\ Ratio=\frac{Asset\ in\ Pools}{Deposits\ made\ by\ LPs\ in\ pools}

Slippage Curve

A swap performed by a trader in MantisSwap involves interaction between two token accounts at the same time. The core element of our swap mechanism is the parameterised slippage curve that maps the liquidity ratio of a token to a slippage value and is used to price assets and determine the swap slippage. Slippage in the context of our design is essential to penalise the actions that drive the liquidity ratio of a token away from 1.

The Mantis model defines the slippage curve as a function of a single parameter i.e. liquidity ratio of the token. The slippage function f(r) is defined as follows:

f(r)={aenr0rka(en(r2k)+2(enrenk))k<rf(r)= \begin{cases} ae^{-nr} & 0 \leq r \leq k\\ a(e^{n(r-2k)} + 2(e^{-nr}-e^{-nk})) & k < r\\ \end{cases}

​Here, r = Liquidity Ratio, k = Inflection Point, a = Maximum Slippage, n = Decay Rate

For all general purposes, k=1. The values of a & n will be initialised with 0.8 & 16 respectively, which can be updated in the future.

Swap Slippage

Using the information above, we get the swap slippage for a swap from token a to token b as follows:

Slippage=f(ra1) f(ra0)ra1  ra0f(rb1) f(rb0)rb1  rb0{Slippage}=\frac{{{f(r}_{a1})\ {-f(r}_{a0})}}{r_{a1}\ {-\ r}_{a0}}-\frac{{{f(r}_{b1})\ {-f(r}_{b0})}}{r_{b1}\ {-\ r}_{b0}}


ra0 = Liquidity Ratio of token 1 before swap

ra1 = Liquidity Ratio of token 1 after swap

rb0 = Liquidity Ratio of token 2 before swap

rb1 = Liquidity Ratio of token 2 after swap

Last updated