# Architecture

## TON Virtual Machine (TVM): A Foundation for Scalability

The TON Virtual Machine (TVM) powers smart contracts on the TON blockchain with cutting-edge features like the **Infinity Sharding Paradigm**, which enables dynamic scalability and lightning-fast transaction processing. This unique approach ensures TON can handle ever-growing demand, making it a robust platform for DeFi innovations like Torch Finance.

However, TVM also presents unique challenges:

* **No Transaction Rollback (between addresses)**: Failed transactions cannot be reversed between different addresses, requiring careful contract design.
* **No Cross-Contract State Access**: Contracts cannot directly retrieve state information from other contracts, necessitating innovative solutions for complex interactions.

## The Advantages of Torch Finance Architecture

Torch Finance is designed to overcome these challenges and maximize TVM’s capabilities. Its architecture offers several key advantages:

1. **High-Speed Transactions**\
   Torch Finance leverages TVM’s Infinity Sharding to enable ultra-fast transaction processing, ensuring scalability even during peak demand.
2. **Single-Sided Liquidity Provision**\
   Users can provide liquidity using a single token instead of pairs.
3. **Quasi-Atomic Swaps for Multi-Token Pools**\
   Supports multi-token pools, allowing seamless exchanges between any tokens within a pool.
   * Faster swaps with reduced routing complexity.
   * Almost atomic execution ensures reliable outcomes.
4. **Meta Pool Liquidity Aggregation**\
   Aggregates liquidity for smaller products, improving their usability while benefiting liquidity providers with higher returns.
5. **Gas Optimization**\
   By building on DeDust’s foundation and introducing further optimizations, Torch Finance reduces gas costs for both single-pool and cross-pool operations.

***

With its innovative architecture, Torch Finance not only addresses TVM’s limitations but also delivers a highly efficient and user-centric DeFi experience on TON.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.torch.finance/dex/getting-started/architecture.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
