↔️Swap Formula

Similar to other AMMs, Möbius Exchange’s swap mechanism is designed to encourage trades that move the system towards equilibrium and discourage trades that move it away from equilibrium. The difference lies in the fact that Möbius Exchange's equilibrium is defined as the coverage ratios of all assets are equal.

Without loss of generality, assume token A has a higher coverage ratio than token B, ra>rbr_a > r_b. If a trader exchanges token B for token A, this action increases the under-covered rbr_b and decreases the over-covered rar_a , hence bringing the pool closer to equilibrium. The pool would therefore offer a favorable rate in incentivize trades in this direction.

Conversely, if a trader exchanges token A for token B, this action further increases the over-covered rar_a and further decreases the under-covered rbr_b , hence further diverging the pool from the equilibrium. The pool would therefore offer a worse rate to penalize the trades in this direction.

This dynamic rate can be expressed mathematically in terms of coverage ratios.

Recall from the previous section, the penalty function is defined as,

p(r)={1,0rrt,(1r1rt)4,rt<r<1,0,r1. p(r) = \begin{cases} 1, & 0 \le r \le r_t,\\[6pt] \left(\frac{1 - r}{1 - r_t}\right)^4, & r_t < r < 1,\\[6pt] 0, & r \ge 1. \end{cases}

As the trader swaps token A to token B, the amount of token A in the pool would increase while the amount of token B would decrease. The coverage ratio of A increases from rAr_A to rAr_A' while B decreases from rBr_B to rBr_B'.

The swap rate is given by

Definition - 4.1

Exchange rateA>B=1+rArAp(r)dr1rArArBrBp(r)dr1rBrB\text{Exchange rate}_{A->B} = 1 + \int_{r_A}^{r_A'} p(r) \, dr* \frac{1}{r_A'-r_A} - \int_{r_B'}^{r_B} p(r) \, dr * \frac{1}{r_B-r_B'}

To evaluate the integral of −p(s) over the interval [r,r][r,r'], we define the function F(r)=r1p(s)ds.F(r) = \int_r^1 -p(s) ds.

Since F(r) is a monotonically decreasing function, it attains its minimum at r=1. This boundary condition F(1)=0 follows naturally from the definition of the integral, as the integral over an interval of zero width vanishes. The closed-form solution for F(r) is derived as follows:

Formula - 4.2

F(r)={1+4rt5r,0rrt,(1r)55(1rt)4,rt<r<1,0,r1.F(r) = \begin{cases} \displaystyle \frac{1 + 4r_t}{5} - r, & 0 \le r \le r_t, \\ \displaystyle \frac{(1 - r)^5}{5(1 - r_t)^4}, & r_t < r < 1, \\ 0, & r \ge 1. \end{cases}

As the system would penalize the action for reducing token B's coverage ratio, while at the same time, reward it for increasing token A's coverage ratio. The value of p(r)p(r) ensures that only when increasing the coverage ratio of an under-covered asset would be rewarded, and further amount that increases the over-covered asset would not be rewarded as p(r)=0p(r) = 0 for r1r \ge 1. Similarly, decreasing an under-covered asset will be penalized, while decreasing an over-covered asset would not be penalized.

Scenario 1: Coverage Ratios within normal range

Under normal market conditions, when both coverage ratios of the two assets to be traded remain above 80% (or a configurable threshold), the value of p(ra)p(r_a) and p(rb) p(r_b) stays near zero. This ensures that swap rates remain stable and attractive to traders, preventing unnecessary slippage while optimizing liquidity efficiency.

Scenario 2: Extreme Coverage Ratios

In abnormal situations, such as when Token A's coverage ratio falls below 60% while Token B's rises to 150%. This implies that Token B is unwanted due to depegging or an increase in Token A's demand.

To safeguard Token A's solvency, the value of p(ra)p(r_a) would become larger as rar_a begins to fall under 60%. Thus penalizing traders for further reducing Token A's coverage ratio. Conversely, the p(r)p(r) would be lower for trades from Token A to Token B as a reward for bringing the pool back from extreme to equilibrium coverage ratio.

Last updated