📜AMM Model
Core concepts and swap mechanism of Mantis AMM
Last updated
Core concepts and swap mechanism of Mantis AMM
Last updated
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.
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:
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.
Using the information above, we get the swap slippage for a swap from token a to token b as follows:
Here,
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