LogoLogo
HomeInterface
  • šŸ¦Welcome to VirtuSwap!
    • šŸ What is VirtuSwap?
    • 🚩Getting Started with VirtuSwap
      • Connect to VirtuSwap
      • How to Trade Tokens
      • Intro to Liquidity Pools Structure on VirtuSwap
      • How to Provide Liquidity
      • How to Withdraw Liquidity
      • How to Disconnect from VirtuSwap
  • VirtuSwap Basics
    • šŸ¤·ā€ā™€ļøThe Problem
    • šŸ”¦Solution Overview
    • šŸŖ™$VRSW Token
      • VRSW Tokenomics
      • VRSW Utility
      • Fees and Incentives
      • Staking Guide
    • šŸ¤–AI agents
    • ā”FAQ
    • šŸš€VirtuSwap Technology
      • How Virtual Pools Work
      • Allowed Virtual Reserves
      • Reserve Ratio and Threshold
      • Exchange of Reserves
      • Providing Liquidity on VirtuSwap
    • šŸ«‚VirtuSwapDAO
      • VirtuSwapDAO Design
      • Participation in VirtuSwap Governance
      • Governance Systems
      • Submitting Proposals
      • VirtuSwapDAO Treasuries and Multi-Signature Wallets
      • VirtuSwap Emergency DAO
    • ā¤ļøMission and Core Principles
  • Technical Reference
    • 🄸Smart Contracts - v1
      • DEX Contracts
        • vPair
        • vPairFactory
        • vRouter 1.1
        • vRouter 1.2
        • vRouter 1.3
        • vExchangeReserves
        • vPoolManager
        • Multicall
        • Structures
        • User Defined Value Types
      • Tokenomics Contracts
        • VGlobalMinter
        • VChainMinter
        • VStaker
        • VTokenomicsParams
        • VVestingWallet
        • Structures
      • Administrative Privileges
    • šŸ“«Deployment Addresses
    • šŸ“¦TypeScript SDK
  • šŸ”Security
Powered by GitBook
On this page
  1. VirtuSwap Basics
  2. VirtuSwap Technology

How Virtual Pools Work

PreviousVirtuSwap TechnologyNextAllowed Virtual Reserves

Last updated 5 months ago

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:

LiqAV=LiqAABāˆ—MIN(LiqBAB,LiqBBC)LiqBABLiqA_V = LiqA_{AB}*\frac{MIN(LiqB_{AB}, LiqB_{BC})}{LiqB_{AB}} LiqAV​=LiqAABā€‹āˆ—LiqBAB​MIN(LiqBAB​,LiqBBC​)​
LiqCV=LiqCBCāˆ—MIN(LiqBAB,LiqBBC)LiqBBCLiqC_V = LiqC_{BC}*\frac{MIN(LiqB_{AB}, LiqB_{BC})}{LiqB_{BC}}LiqCV​=LiqCBCā€‹āˆ—LiqBBC​MIN(LiqBAB​,LiqBBC​)​

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.

šŸš€
VirtuSwap Whitepaper