Torch DEX
WebsiteSwap
  • Overview
  • Terms of Use
  • Getting Started
    • Introduction
    • Challenges on TON
    • Solution for TON
    • Architecture
      • Concept
      • Core Components
        • Factory
        • Vault
        • Pool
        • LP Account
        • Oracle
      • Comparison
      • Interoperability
      • Meesage Flows
        • Deposit
        • Swap
        • Withdraw
        • Cross-Pool Operations
  • Developer Guide
    • DEX SDK Guide
      • Setup
      • Perform Swap
      • Deposit Liquidity
      • Withdraw Liquidity
      • How to send transaction
        • Mnemonic (Node JS)
        • TonConnect (React)
      • Deployments
  • USER Guide
    • Getting Started
  • Protocol
    • Audits
    • Tokenomics
  • Other
    • Brand Kit
    • Contacts
    • Achievements
  • FAQ
    • How to get Transaction hash by Message hash
    • React (Vite) - Buffer Issues
Powered by GitBook
On this page
  1. Getting Started
  2. Architecture
  3. Meesage Flows

Swap

PreviousDepositNextWithdraw

Last updated 4 months ago

TorchSwapFlow

Torch’s Stable Swap mechanism effectively reduces slippage during swaps, providing a more cost-efficient trading experience. Below is a detailed breakdown of the swap process:

  1. Asset Transfer to Vault

    • Users transfer the asset they wish to swap (swap in asset) to the corresponding Vault contract.

  2. Vault Notifies Pool

    • Once the Vault receives the asset, it sends an op::swap_internal message to the Pool contract, initiating the swap calculation.

  3. Pool Calculates and Notifies Vault

    • After the calculation, the Pool determines the amount of the swap out asset and sends an op::payout message to the Vault responsible for the swap out asset.

    • The Vault then transfers the swapped asset to the user’s designated address as instructed.

  4. Cross-Pool Swap Operations

    • If the swap involves cross-pool operations, the Pool includes swap details and sends an op::swap_between or op::withdraw_between message to the next Pool to continue the swap process.

    • A detailed explanation of cross-pool operations will be provided in the .

following sections