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. Technical Reference
  2. Smart Contracts - v1
  3. DEX Contracts

User Defined Value Types

User Defined Value Types used in VirtuSwap DEX contracts

PreviousStructuresNextTokenomics Contracts

Last updated 6 months ago

RouteData

RouteData is a value type, defined as uint256. It is utilized to store compact information about trading route steps in the . The RouteData type combines multiple pieces of route-related data into a single uint256 value for optimized on-chain processing.

The RouteData encodes three pieces of information:

  • Transit Start Index is stored in the most significant 64 bits (bits 192-255). It indicates the index of the first intermediate token in the array of transit tokens addresses of the route.

  • Transit Length is stored in the next 64 bits (bits 128-191). It represents the number of intermediate tokens in the route step. If set to type(uint64).max, it signifies a virtual swap (a case when a swap on the will be executed if it is not locked).

  • Amount is stored in the least significant 128 bits (bits 0-127). It is equal to the token amount involved in the route (amountIn for exact in swaps or amountOut for exact out swaps).

For direct swaps (through one real pool) the transit length is equal to 0 and transit tokens are ignored.

🥸
vRouter 1.3
virtual pool