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
  • The Role of LP Vault
  • Benefits of This Design
  • Safety Notice
  • The Importance of Balanced Deposits
  • Example – triTON Pool (TON/tsTON/stTON)
  • Avoiding Unbalanced Deposits
  1. Getting Started
  2. Architecture
  3. Meesage Flows

Deposit

PreviousMeesage FlowsNextSwap

Last updated 4 months ago

Deposit message flow

To provide liquidity to Torch Finance's N-asset pool, users can choose to deposit between 1 to N assets. Since TON operates as an asynchronous system, the deposit process follows these steps:

  1. Asset Deposit into Vault

    • Users deposit each asset into its corresponding Vault contract.

  2. Vault Notifies Factory

    • After receiving the assets, the Vault sends an op::deposit_internal message to the Factory.

    • This message contains details of the liquidity provided by the user.

  3. Factory Deploys LP Account

    • Based on the message, the Factory deploys a dedicated LP Account contract for the user.

    • The LP Account records the deposit and waits for the remaining assets.

  4. All Assets Deposited

    • Once the LP Account confirms all assets have been deposited, it sends an op::deposit_all message to the Pool with deposit details.

  5. Pool Calculates and Notifies Lp Vault

    • After completing the necessary calculations, the Pool sends an op::payout to the Pool’s LP Vault, instructing it to transfer LP tokens to the user’s designated recipient.

  6. Cross-Pool Deposits Operations

    • If the deposit involves cross-pool operations, the base pool will include relevant deposit details and send an op::deposit_between or op::swap_between message to the next pool for further processing.

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


The Role of LP Vault

You might wonder: When does the LP Vault come into play, and why does it already hold LP tokens for transfer?

This is because, during Pool creation, Torch automatically performs the following:

  • LP Vault is deployed alongside the Pool as a dedicated storage for pool assets.

  • LP tokens are preminted to the LP Vault at the time of deployment (LP Vault is a type of Jetton Vault).


Benefits of This Design

  1. Simplified Pool Logic

    • The Pool does not need to handle LP token minting after deposits.

    • Similar to swap operations, the Pool simply instructs the Vault to transfer LP tokens, reducing complexity.

  2. Efficient Cross-Pool Operations

    • When LP tokens are generated through cross-pool operations, the Pool doesn’t need to mint additional LP tokens to the LP Vault.

    • This reduces gas costs and enhances overall efficiency.

This design enhances system efficiency, lowers costs during high-frequency trades or cross-pool operations, and streamlines asset management across the Torch ecosystem.


Safety Notice

When depositing to Torch Finance, users are advised to deposit assets in balanced proportions to minimize fees during the deposit process. The more balanced the deposit, the lower the fees, improving the efficiency and cost-effectiveness of liquidity provision.

The Importance of Balanced Deposits

Depositing assets in highly unbalanced proportions may result in higher fees. While this typically only occurs when depositing large amounts, maintaining balanced deposits can significantly reduce costs and avoid unnecessary fees.

Example – triTON Pool (TON/tsTON/stTON)

Suppose the price of stTON is 1.0428 TON and tsTON is 1.036 TON. Users are encouraged to deposit assets according to the following ratio:

  • TON : stTON : tsTON = 1 : 1 / 1.036 : 1 / 1.0428

Depositing in this proportion helps minimize fees and ensures optimal asset balance.

Avoiding Unbalanced Deposits

For example, in the triTON Pool, if a user deposits assets in severely unbalanced amounts:

  • 11000 TON / 10 tsTON / 10 stTON

Such highly disproportionate deposits will result in significant fees and are strongly discouraged.

By maintaining balanced asset ratios, users can optimize deposit costs, enhance the deposit experience, and avoid unnecessary fee expenses.

following sections