# Router

## **Contract Info**

* **Contract Name**: `evo::router`
* **Contract Address**: \[tba]
* **Admin Multi Sig**: \[tba]

### Public Functions

***

#### **Create Pair**

Creates a new liquidity pair for tokens X and Y. Reverts if the pair already exists.

```move
public entry fun create_pair<X, Y>(sender: &signer)
```

| Input Values | Type   | Description          |
| ------------ | ------ | -------------------- |
| sender       | signer | The sender's signer. |

***

#### **Register Fee On Transfer in Pair**

Adds fee-on-transfer functionality to a token pair (only callable by token owners).

```move
public entry fun register_fee_on_transfer_in_a_pair<CoinType, X, Y>(sender: &signer)
```

| Input Values | Type   | Description          |
| ------------ | ------ | -------------------- |
| sender       | signer | The sender's signer. |

***

#### **Stake Tokens in Pool**

Deposit tokens into the staking pool for a liquidity pair.

```move
public entry fun stake_tokens_in_pool<X, Y>(sender: &signer, amount: u64)
```

| Input Values | Type   | Description                    |
| ------------ | ------ | ------------------------------ |
| sender       | signer | The sender's signer.           |
| amount       | u64    | The amount of tokens to stake. |

***

#### **Unstake Tokens from Pool**

Withdraw tokens from the staking pool for a liquidity pair.

```move
public entry fun unstake_tokens_from_pool<X, Y>(sender: &signer, amount: u64)
```

| Input Values | Type   | Description                       |
| ------------ | ------ | --------------------------------- |
| sender       | signer | The sender's signer.              |
| amount       | u64    | The amount of tokens to withdraw. |

***

#### **Claim Rewards from Pool**

Claim staking rewards from the rewards pool.

```move
public entry fun claim_rewards_from_pool<X, Y>(sender: &signer)
```

| Input Values | Type   | Description          |
| ------------ | ------ | -------------------- |
| sender       | signer | The sender's signer. |

***

#### **Add Liquidity**

Add liquidity to a pair or create the pair if it doesn't exist.

```move
public entry fun add_liquidity<X, Y>(sender: &signer, amount_x_desired: u64, amount_y_desired: u64, amount_x_min: u64, amount_y_min: u64)
```

| Input Values       | Type   | Description                           |
| ------------------ | ------ | ------------------------------------- |
| sender             | signer | The sender's signer.                  |
| amount\_x\_desired | u64    | The amount of token X desired.        |
| amount\_y\_desired | u64    | The amount of token Y desired.        |
| amount\_x\_min     | u64    | The minimum amount of token X to add. |
| amount\_y\_min     | u64    | The minimum amount of token Y to add. |

***

#### **Remove Liquidity**

Remove liquidity from a pair.

```move
public entry fun remove_liquidity<X, Y>(sender: &signer, liquidity: u64, amount_x_min: u64, amount_y_min: u64)
```

| Input Values   | Type   | Description                               |
| -------------- | ------ | ----------------------------------------- |
| sender         | signer | The sender's signer.                      |
| liquidity      | u64    | The amount of liquidity to remove.        |
| amount\_x\_min | u64    | The minimum amount of token X to receive. |
| amount\_y\_min | u64    | The minimum amount of token Y to receive. |

***

#### **Swap Exact Input**

Swap an exact input amount of token X for the maximum possible amount of token Y.

```move
public entry fun swap_exact_input<X, Y>(sender: &signer, x_in: u64, y_min_out: u64)
```

| Input Values | Type   | Description                               |
| ------------ | ------ | ----------------------------------------- |
| sender       | signer | The sender's signer.                      |
| x\_in        | u64    | The exact amount of token X to swap.      |
| y\_min\_out  | u64    | The minimum amount of token Y to receive. |

***

#### **Swap Exact Output**

Swap the minimum possible amount of token X to receive an exact output amount of token Y.

```move
public entry fun swap_exact_output<X, Y>(sender: &signer, y_out: u64, x_max_in: u64)
```

| Input Values | Type   | Description                             |
| ------------ | ------ | --------------------------------------- |
| sender       | signer | The sender's signer.                    |
| y\_out       | u64    | The exact amount of token Y to receive. |
| x\_max\_in   | u64    | The maximum amount of token X to swap.  |

***

#### **Multi-Hop Exact Input**

Swap token X for token Y through an intermediate token Z.

```move
public entry fun swap_exact_input_with_one_intermediate_coin<X, Y, Z>(sender: &signer, x_in: u64, y_min_out: u64)
```

| Input Values | Type   | Description                               |
| ------------ | ------ | ----------------------------------------- |
| sender       | signer | The sender's signer.                      |
| x\_in        | u64    | The exact amount of token X to swap.      |
| y\_min\_out  | u64    | The minimum amount of token Y to receive. |

***

#### **Register LP**

Register the LP token for a pair to the sender's account.

```move
public entry fun register_lp<X, Y>(sender: &signer)
```

| Input Values | Type   | Description          |
| ------------ | ------ | -------------------- |
| sender       | signer | The sender's signer. |

***

#### **Update Fee Tier**

Update the fee tier for a liquidity pair.

```move
public entry fun update_fee_tier<Tier, X, Y>(signer_ref: &signer)
```

| Input Values | Type   | Description          |
| ------------ | ------ | -------------------- |
| signer\_ref  | signer | The sender's signer. |


---

# 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.evo.market/technical/amm/router.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.
