Deposit
Last updated
Last updated
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:
Asset Deposit into Vault
Users deposit each asset into its corresponding Vault contract.
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.
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.
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.
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.
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 following sections.
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).
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.
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.
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.
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.
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.
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.