# Swap

This is the risk marketplace for SMART tokens providing liquidity for the new instruments. The platform supports two main types of swaps: standard `swaps` and `split-and-swap` operations.

### Types of Swaps

1. Standard Swap:
   * **Description:** Users can trade between the underlying token and the two SMART tokens (RiskOn and RiskOff) within customized elastic supply pools. This setup facilitates various trading strategies, including buying, selling, and providing liquidity.
   * **Use Cases:**
     * **Traders:** Can capitalize on market opportunities by swapping tokens based on market conditions.
     * **Liquidity Providers:** Can supply liquidity to the pools, earning fees from trades.
     * **Arbitrageurs:** Can exploit price differences across pools to generate profit.
2. Split and Swap:
   * **Description:** This function allows users to deposit the underlying token and simultaneously swap one of the resulting SMART tokens for the other in a single, atomic transaction. This is particularly useful for traders who prefer to hold only one type of SMART token.
   * Use Cases:
     * **Simplified Trading:** Facilitates easy conversion of underlying assets into the desired SMART token without multiple transactions.
     * **Risk Management:** Enables users to quickly adjust their exposure to risk by swapping tokens in a single step.

Process

1. **Approve Tokens:** Users must `approve` the TokenFactory contract to spend their underlying tokens before initiating a swap.
2. Execute Swap:
   * For a standard swap, users specify the amount of the underlying token and the desired SMART token.
   * For a split and swap, users specify the amount of the underlying token and the SMART token they wish to swap for its counterpart.
3. **Receive Tokens:** The resulting tokens are transferred to the user's address.

Example Usage:

Benefits:

* **Flexibility:** Supports various trading strategies and needs, from simple token swaps to more complex risk management maneuvers.
* **Efficiency:** Reduces transaction costs and execution time by allowing atomic swaps, particularly with the split-and-swap function.
* **Market Opportunities:** Empowers traders, liquidity providers, and arbitrageurs to effectively capitalize on market movements and liquidity gaps.

Additional Details:

* **Elastic Supply Pools:** The pools dynamically adjust to supply and demand, ensuring optimal liquidity and pricing.
* **Transaction Transparency:** Users can track swap transactions and resulting token balances through the platform’s interface.
* **Security:** All transactions are secured by the TRP smart contracts, ensuring reliability and safety.
