# Swap

{% hint style="info" %}
Swapping requires a balance of tokens, which can be claimed through our Faucet in the sidebar. Refer to [Beta Access](https://alphix.gitbook.io/docs/quick-start/beta).
{% endhint %}

The [Swap](https://www.alphix.fi/swap) page lets you exchange tokens through **Unified Pools**.

#### **UI Elements**

<figure><img src="https://2585924356-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkT5rrR3T549DQrmc5r1F%2Fuploads%2Flj0KAcyDhi4f2gMcA7EO%2FSwap.png?alt=media&#x26;token=5969f489-159a-4510-9c38-f4cd80881c7f" alt=""><figcaption></figcaption></figure>

{% stepper %}
{% step %}
**Swap Interface**
{% endstep %}

{% step %}
**Token Selection**

<mark style="color:$info;">Select from the existing Beta Tokens - aBTC, aETH, aUSDC, aUSDT - to swap between them.</mark>
{% endstep %}

{% step %}
**Input Amount**

<mark style="color:$info;">Users can specify either the token input or the token output to swap to a predefined amount of tokens.</mark>
{% endstep %}

{% step %}
**Multi-Hop Routes**

<mark style="color:$info;">The swap interface displays the route a swap takes. This can be as simple as a set of two tokens or more complex if there is no existing Unified Pool with the selected tokens. In that case, the swap is routed through multiple pools. The tokens can be hovered over to switch between the different dynamic fee trend views.</mark>
{% endstep %}

{% step %}
**Dynamic Fee Trend**

<mark style="color:$info;">The dynamic fee trend is a graph plotting the recent 30-day trend to provide additional context for the current fee. This allows swappers to understand the context in which they are swapping, which informs trading decisions.</mark>
{% endstep %}

{% step %}
**Liquidity Page Shortcut**

<mark style="color:$info;">Clicking on the dynamic fee trend segment takes the user directly to the liquidity page of the corresponding pool, which provides deeper analytics - more information in</mark> [liquidity](https://alphix.gitbook.io/docs/quick-start/liquidity "mention")<mark style="color:$info;">.</mark>
{% endstep %}
{% endstepper %}

#### Performing the First Swap

Alphix uses [Permit2](https://github.com/dragonfly-xyz/useful-solidity-patterns/tree/main/patterns/permit2) to streamline approvals. During the initial swap, this requires three steps.

<figure><img src="https://2585924356-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkT5rrR3T549DQrmc5r1F%2Fuploads%2Fx6wzdw7D2X3NFk2AIVry%2FTransactions.png?alt=media&#x26;token=a8bc4ef3-ae1b-4da5-a0c7-8143dcb706c4" alt=""><figcaption></figcaption></figure>

{% stepper %}
{% step %}
**Approve Permit2**

<mark style="color:$info;">This grants Permit2 the authority to manage token approvals through a single, secure contract. The user retains the power to decide what amount of tokens to approve; by default, the connected wallet will prompt infinity.</mark>
{% endstep %}

{% step %}
**Sign Token Permit**

<mark style="color:$info;">After the Permit2 Contract is approved to access tokens, a permit has to be signed enabling it to interact with the PoolManager using the user's tokens. This signature has a deadline set at 30 minutes and only enables the exact swap amount to be accessed.</mark>
{% endstep %}

{% step %}
**Execute the Swap**

<mark style="color:$info;">As the final step, the Swap Modal prompts the swap transaction to the user.</mark>
{% endstep %}
{% endstepper %}

{% hint style="info" %}
In the testnet Beta, the Permit2 setup is simplified to reduce UX friction
{% endhint %}

After the initial setup with Permit2, the user can swap with two transactions if an unlimited Permit2 allowance was approved. By default, Alphix will prompt the user to sign a permit that is only for the selected swap amount and will expire after 24 hours. Subsequent swaps or swaps after expiry of Permit2 require a new signature but no approval transaction, freeing the user from paying gas fees while remaining secure.
