Exploring decentralized exchange algorithms, I've found out that most are focused on swap of two tokens, but theoretically they can be extended to multiple ones without loss of functionality.
Examples of two-token liquidity pools
A, B - reserve of tokens in the pool (so, they don't belong to any user, except maybe liquidity providers).
A∗B=const
.
For example,
A=1000,B=2000
.
Suppose person wants to swap 5 A tokens for some B. Then, pool will have
A′=1005
, and to maintain invariant
A∗B=2′000′000
it will retain
B′=1990
, sending 10 B out.
A3∗B+A∗B3=const
.
Ap∗B1−p=const
(Maniswap; p changes over liquidity additions and is used to keep the price same).
Natural extensions
A∗B∗C∗D∗...=const
.
Any swap here is equivalent to swap in basic pool, since amount of any other token except two chosen is constant. Though, I have been said that it has problems with liquidity.
A∗B+A∗C+B∗C+A∗D+...=const
. Sum of pairwise products of token reserves is constant.
Let's calculate how many B (dB) will pool return when receiving some A (dA).
I haven't found any problems with such a pool so I think it can be used to shorten swaps (now, some can take several steps). It can even be used without computers, meaning possible replacement for barter!
Top comments (0)
Subscribe
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)