# Swap

## Overview

The `UniswapSwapAndLiquidity` contract is designed to interact with the Uniswap V2 decentralized exchange platform.&#x20;

It facilitates two primary DeFi activities: swapping tokens and adding liquidity to Uniswap pools.&#x20;

By integrating with the Uniswap V2 Router, this contract provides users with the ability to engage in token swaps and liquidity provision directly through the contract, simplifying and streamlining these processes.

## Methods

## <mark style="color:blue;">`swapTokens`</mark>

Swaps tokens using the Uniswap V2 Router

### Parameters

| Name            | Type      | Description                                    |
| --------------- | --------- | ---------------------------------------------- |
| `_tokenIn`      | `address` | The address of the input token.                |
| `_tokenOut`     | `address` | The address of the output token.               |
| `_amountIn`     | `uint256` | The amount of input tokens to swap.            |
| `_amountOutMin` | `uint256` | The minimum amount of output tokens to accept. |
| `_to`           | `address` | The address to send output tokens to.          |

## <mark style="color:blue;">`addLiquidity`</mark>

Adds liquidity to a Uniswap pool.

### Parameters

| Name          | Type      | Description                                    |
| ------------- | --------- | ---------------------------------------------- |
| `_tokenA`     | `address` | The address of the first token.                |
| `_tokenB`     | `address` | The address of the second token.               |
| `_amountA`    | `uint256` | The amount of the first token.                 |
| `_amountB`    | `uint256` | The amount of the second token.                |
| `_amountAMin` | `uint256` | The minimum amount of the first token to add.  |
| `_amountBMin` | `uint256` | The minimum amount of the second token to add. |
