Principle

1、The reason for slippage loss

Since when adding liquidity to a decentralized exchange, tokens A and B need to be provided at a value of 1:1. When the values ​​of A and B are not equal, the leverage agreement will first perform an exchange, so that the exchanged A, The value of B is equal. When the amount of this exchange is too large and the liquidity of the exchange pool is insufficient, the transaction price of this exchange transaction will deviate from the market price, causing slippage loss. Similarly, when the liquidity is removed and the position is closed, the 1:1 value of A and B obtained from the removal of liquidity needs to be used to repay the leveraged debt. When the leverage is too large and the debt is too concentrated on A (or B), the leverage agreement will also perform a conversion first to repay in full. This exchange will also cause slippage loss.

2、The feature for slippage loss

Assuming that the liquidity of token A in the exchange pool is AReserve, the values ​​of the first two tokens used to add liquidity are AValue and BValue:

{AValue=(ASupply+ABorrow)×APriceBValue=(BSupply+BBorrow)×BPrice     ①\begin{cases} AValue=\left(ASupply+ABorrow\right)\times APrice \\ BValue=\left(BSupply+BBorrow\right)\times BPrice \end{cases}\ \ \ \ \ ①

The total value of Token A and Token B:

SupplyValue=ASupply×APrice+BSupply×BPriceSupplyValue=ASupply\times APrice+BSupply\times BPrice

then the slippage loss will be S:

S=(2×AReserve×APrice)2+(AValueBValue)22×AReserve×APriceSupplyValue     ②S=\frac{\sqrt{\left(2\times A R e s e r v e\times A P r i c e\right)^2+\left(AValue-BValue\right)^2}-2\times A R e s e r v e\times A P r i c e}{SupplyValue}\ \ \ \ \ ②

It can be proved that under the same conditions, the worse the liquidity of the exchange pool or the greater the difference between AValue and BValue, the greater the slippage loss rate, and the maximum possible slippage loss is equal to the difference between AValue and BValue. This is well understood. The closer the ratio of AValue to BValue before exchange is 1:1, the smaller the scale of exchange required, the smaller the impact of exchange on the price, and the smaller the slippage loss.

3、How does Archimedes solve this issue:

According to the above conclusions. The Archimedes protocol chooses to reduce slippage loss by reducing and eliminating the difference between AValue and BValue. At the same time, as users continue to disconnect the warehouse, the liquidity of the exchange pool becomes better and better, and the slippage loss will be further Become smaller. We have noticed that when the user decides the amount of pledged tokens ASupply, BSupply and the leverage multiple N (the expected return is known at this time), the total value AValue+BValue before exchange has been determined:

AValue+BValue=N×SupplyValueAValue+BValue=N\times SupplyValue

But according to formula ①, to determine the difference between AValue and BValue, you also need to determine the borrowing amounts of A and B, ABorrow and BBorrow, respectively. According to the agreement of the decentralized exchange, when ABorrow and BBorrow meet:

ASupply+ABorrowBSupply+BBorrow=AReserveBReserve\frac{ASupply+ABorrow}{BSupply+BBorrow}=\frac{AReserve}{BReserve}

The difference between AValue and BValue is zero, the agreement can directly add liquidity without exchange, and the slippage loss is zero. In the case where ASupply, BSupply, and leverage N are determined, ABorrow and BBorrow that satisfy the above formula are the only ones. The Archimedes protocol implements this function: According to the amount of pledged tokens provided by the user ASupply, BSupply, and the leverage multiple N, calculate the best (lowest slippage) borrowing amount ABorrow and BBorrow for opening a position, in most cases Down can make the slippage loss almost zero.

Last updated