3 FreeSwap Arbitrage Fairness Analysis #
3.1 Arbitrage fairness principles #
From the perspective of the liquidity provider, for the internal exchange of the two sub-pools, ie. arbitrage operations, following considerations should be taken:
Pool A and Pool B must both obtain positive returns in arbitrage operations. If one party gains and the other loses, the arbitrage mechanism does not hold;
The arbitrage return of two sub-pools should be balanced reasonably. If one side gains more and the other side gains less, the arbitrage mechanism is also not perfect.
Pool A and Pool B both expect to maximize their profits in the arbitrage operations. The ideal goal of the arbitrage mechanism is to maximize the profits of both sub-pools simultaneously.
3.2 FreeSwap arbitrage fairness analysis #
FreeSwap arbitrage protocol can meet the above three requirements, that is, it can achieve the maximum positive profit for both sides of the trading pools, and the profits of both sides are equal.
The arbitrage profit can be counted by the changes of "constant-product invariant" of the sub-pools before and after the arbitrage operation. After the arbitrage completed, the changes in the K value of the two sub-pools are analyzed below.
For the A-Pool, the change in K value after arbitrage is:
ΞKAββ=(NAAββLAβ)β(NBβ+LBβ)βNAAββNBβ=NAAββLBββLAββNBββLAββLBβ=βPAβBeββLA2β+(NAAββPAβBeββNBβ)βLAβ=βPAβBeββ(LAββ2NAAββNBββPBβAeββ)2+4βPBβAeβ(NAAββNBββPBβAeβ)2ββ(3.1.1) It can be seen that for A-Pool, while LAβ=LAMβ, K value increases the most, that is, A-Pool gets the maximum arbitrage profit as:
LAMββ=2NAAββNBββPBβAeββ=2β(NBβ+NBBβ)NAAββNBBββNAββNBβββ(3.1.2) It is obvious that LAeβ in (2.4.19) equals to LAMβ, it means that FreeSwap arbitrage mechanism can increase K value of the A-Pool to its maximum, which is:
ΞKAMββ=4βPBβAeβ(NAAββNBββPBβAeβ)2β=4β(NAβ+NAAβ)β(NBβ+NBBβ)(NAAββNBBββNAββNBβ)2ββ(3.1.3) Similarly, for the B-Pool, the K value changes after arbitrage is as follows:
ΞKBββ=(NBBββLBβ)β(NAβ+LAβ)βNBBββNAβ=NBBββLAββLBββNAββLAββLBβ=βPBβAeββLB2β+(NBBββPBβAeββNAβ)βLBβ=βPBβAeββ(LBββ2NBBββNAββPAβBeββ)2+4βPAβBeβ(NBBββNAββPAβBeβ)2ββ(3.1.4) Similarly for the B-Pool, when LBβ=LBMβ, the K value has the largest increase, that is, the B-Pool gets the maximum arbitrage profit:
LBMββ=2NBBββNAββPAβBeββ=2β(NAβ+NAAβ)NAAββNBBββNAββNBβββ(3.1.5) Samely, LBeβ in (2.4.19) is equal to LBMβ, that is, FreeSwap arbitrage mechanism can increase K value of B-Pool to the maximum:
ΞKBMββ=4βPAβBeβ(NBBββNAββPAβBeβ)2β=4β(NAβ+NAAβ)β(NBβ+NBBβ)(NAAββNBBββNAββNBβ)2ββ(3.1.6) Comparing (3.1.3), (3.1.6) and (2.4.19), we can see that:
ΞKBMββ‘ΞKAMββ‘LAeββLBeβ(3.1.7) This means that FreeSwap arbitrage protocol can simultaneously maximize the increment of K Value both for A-Pool and B-Pool by arbitrage, and the K value increment in the two sub-pools are exactly the same, which equals to the product of the amount of tokens internaly exchanged within arbitrage between the sub-pools.