# Pool V2

## **What is a Pool V2?**

Ociswap Pool V2 (<mark style="color:green;">`OP`</mark>) uses Radix's native "[Resource Pools](https://docs-babylon.radixdlt.com/main/scrypto/native-blueprints/resource-pools.html)" as a building block. In particular, it utilises the *TwoResourcePool (*<mark style="color:purple;">`TRP`</mark>*)*, which is a liquidity pool that contains a pair of digital assets (e.g. `$XRD/$OCI`). This<mark style="color:purple;">`TRP`</mark>holds the market's liquidity for a single pool and is exclusively managed by its corresponding <mark style="color:green;">`OP`</mark>.&#x20;

By making use of the <mark style="color:purple;">`TRP`</mark>, the <mark style="color:green;">`OP`</mark> can provide [pool units](https://www.radixdlt.com/blog/using-native-pools-and-pool-units-for-intuitive-liquidity-provider-ux) (LP-tokens) that are fully compatible with the official Radix Wallet. This ensures a great user experience, because the Radix Wallet transparently showcases the underlying tokens, while allowing users to seamlessly access and intuitively manage their funds at all times.&#x20;

## Pool V2 Features

* **Swaps:**\
  The <mark style="color:green;">`OP`</mark> uses a Constant Product Automated Market Maker formula to create a market and calculate prices and trading outputs.
* **Trading Fees:**\
  The <mark style="color:green;">`OP`</mark> charges trading fees on each swap, with the fee tier selected during pool creation. Creators can choose from 0.01%, 0.05%, 0.3%, or 1% fee tiers to optimize for different trading patterns. For each trade, fees are distributed with 85% rewarding liquidity providers and 15% supporting protocol growth. Trading fees automatically accrue to liquidity providers of the <mark style="color:purple;">`TRP`</mark> and are included when they redeem their position.
* **Auto-Compounding:**\
  The <mark style="color:green;">`OP`</mark> consistently reinvests the trading fees back into the liquidity pool. This boosts returns and creates a hassle-free experience for liquidity providers.
* 🔜 **Price Oracle:**\
  On-ledger pool-based oracles provide users with accurate and tamper-resistant price data. The oracle calculates the price of tokens based on the trading dynamics and liquidity ratios within these pools.
* 🆕 **Hooks:**\
  Users can execute custom code before and after certain events within the liquidity pool, such as swaps or liquidity updates. This capability allows for a wide range of innovative applications and functionalities on Ociswap. [Learn more](/ociswap-dex/liquidity-pools/hooks.md).
* 🆕 **Flash Loans:**\
  Users may borrow assets from a liquidity pool without providing collateral, under the condition that the loan is borrowed and repaid within the same transaction. Flash loans allow users to capitalize on discrepancies in prices across different exchanges (arbitrage), swap one collateral type for another without closing a position (collateral swap), or pay off debts to avoid liquidation (self-liquidation).
* 🆕 **Imbalanced Ratios:**\
  Users can customize the asset ratio within a pool, which can range from 5/95 to 5/95 and anything in-between. This enables liquidity providers to have more control over their exposure to specific assets.

## How do Pool V2 work?

To understand the design concepts of the <mark style="color:green;">`OP`</mark>, it's crucial to grasp which functions are provided by the <mark style="color:purple;">`TRP`</mark> and how the <mark style="color:green;">`OP`</mark> is built around it:

> 1. **Instantiate Pool**\
>    Allowing users to create a <mark style="color:green;">`OP`</mark> with a corresponding <mark style="color:purple;">`TRP`</mark> to hold its liquidity.
> 2. **Add Liquidity**
>
>    Allowing users to provide liquidity to a <mark style="color:green;">`OP`</mark>, which is deposited into the <mark style="color:purple;">`TRP`</mark> using its *`Contribute`* function. Liquidity is provided in token pairs, matching the pool's ratio.
> 3. **Remove Liquidity**\
>    Allowing users to withdraw their liquidity from the <mark style="color:green;">`OP`</mark> via the <mark style="color:purple;">`TRP`</mark>'s *`Redeem`* function.&#x20;
> 4. **Swap**\
>    Allowing users to execute trades through the <mark style="color:green;">`OP`</mark>. During the swap, the <mark style="color:green;">`OP`</mark> utilises the *`Protected Deposit`* and *`Protected Withdraw`* functions of the <mark style="color:purple;">`TRP`</mark> to amend its token holdings.

**For more information about Ociswap Pool V2, visit our** [**blog article**](https://ociswap.com/blog/pool-v2-powering-radix-defi)**.**

{% hint style="info" %}
Users can also interact with the *`Redeem`* function of the <mark style="color:purple;">`TRP`</mark> directly from the Radix Wallet, allowing them to withdraw liquidity at any time.
{% endhint %}

{% hint style="info" %}
Ociswap Pool V2 is [**audited**](https://audits.hacken.io/ociswap/sca-ociswap-pool-v2-aug2024/) and [**open source**](https://github.com/ociswap/pool) at its core.&#x20;

You deserve the best quality from our team.
{% endhint %}


---

# 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://docs.ociswap.com/ociswap-dex/liquidity-pools/pool-v2.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.
