How Virtual Pools Work
Last updated
Last updated
A Virtual Pool can be composed from two native AMM pools if they share one common asset, and also if at least one of the pools accepts the non-common asset from the other pool as a reserve.
For example, if native pairs between A-B and B-C exist, and the A-B pool can accept C as a reserve token, a virtual pool A-C can be created, capable of performing C-A trades.
To reflect the nomenclature, the first of the two pools composing the Virtual Pool is called jkPool or Active Pool and the second pool is called ikPool or Reference Pool.
When a swap occurs, the Active Pool (A-B in the example above) performs the actual exchange of the tokens by accepting a certain amount of token C to its reserves, and paying out a corresponding amount of token A. The Reference Pool (B-C in the example) is used for constructing a virtual AMM curve between A and C, which is used to calculate the amount of A that should be swapped for a given amount of C.
The liquidity in the Virtual Pool is calculated as follows:
As can seen from the formulas above, the total value of the two balances of the Virtual Pool equals the TVL of the smaller one of the two pools.
After a swap is completed, the Active Pool A-B ends up with a lower amount of Token A and a corresponding amount of C in reserves. Since token B is not participating in the swap, the pool's imbalance (and thus arbitrage opportunity) is much lower than in the case of a regular trade. The reserve token C is to be exchanged at a later point in time for A or B with other pools in the system.