# Custom exchange

<figure><img src="https://2227986809-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiXsnL20jyBNNxpiEbHVU%2Fuploads%2F539rmNN7fA7EfcBTeG3y%2Fimage.png?alt=media&#x26;token=a55fe53a-adc0-4efa-8e93-ca6bb177ff67" alt=""><figcaption></figcaption></figure>

You can use custom DEXes on [20lab.app](https://20lab.app/) if you want to use exchanges that aren't listed in our default options. If you want to use a DEX that we haven't added yet, you can do this by selecting the "Custom exchange" option and providing valid RouterV2 smart contract address.\
\
Follow these steps to make sure you can continue once you choose your DEX:

### 1. Find the RouterV2 Smart Contract Address

You'll need to find the RouterV2 address and enter it below the "Custom Exchange" drop down menu. Here's how to find it:

* Go to your DEX's documentation or website
* Look for a section called "deployed contract addresses" or "smart contracts"
* Find the RouterV2 address, copy it, and paste it into the correct field

### 2. Check if Your DEX Has the Right Functions

Don't worry - 20lab automatically checks if your custom exchange has all the functions it needs before creating your ERC-20 token or using tools. Most DEXes that are Uniswap forks will work fine, , unless they've intentionally removed or changed the original functions.

Your custom exchange needs to have these specific functions for your token to be correctly integrated. You need different sets of functions depending on whether you are creating a new ERC-20 token or using ERC-20 tools.

#### When generating new ERC-20 token

**RouterV2 smart contract**

```solidity
function factory() external pure returns (address);

function WETH() external pure returns (address);

function addLiquidityETH(
    address token,
    uint amountTokenDesired,
    uint amountTokenMin,
    uint amountETHMin,
    address to,
    uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);

function removeLiquidityETH(
    address token,
    uint liquidity,
    uint amountTokenMin,
    uint amountETHMin,
    address to,
    uint deadline
) external returns (uint amountToken, uint amountETH);

function swapExactTokensForTokensSupportingFeeOnTransferTokens(
    uint amountIn,
    uint amountOutMin,
    address[] calldata path,
    address to,
    uint deadline
) external;

function swapExactTokensForETHSupportingFeeOnTransferTokens(
    uint amountIn,
    uint amountOutMin,
    address[] calldata path,
    address to,
    uint deadline
) external;
```

**Factory smart contract**

```solidity
function createPair(address tokenA, address tokenB) external returns (address pair);
```

#### When using ERC-20 tools

**RouterV2 smart contract**

```solidity
function addLiquidity(
    address tokenA,
    address tokenB,
    uint amountADesired,
    uint amountBDesired,
    uint amountAMin,
    uint amountBMin,
    address to,
    uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);

function addLiquidityETH(
    address token,
    uint amountTokenDesired,
    uint amountTokenMin,
    uint amountETHMin,
    address to,
    uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);

function removeLiquidity(
    address tokenA,
    address tokenB,
    uint liquidity,
    uint amountAMin,
    uint amountBMin,
    address to,
    uint deadline
) external returns (uint amountA, uint amountB);

function removeLiquidityETH(
    address token,
    uint liquidity,
    uint amountTokenMin,
    uint amountETHMin,
    address to,
    uint deadline
) external returns (uint amountToken, uint amountETH);
```

{% hint style="warning" %}
**What we check for**

1. All the functions listed above must exist, depending on the service being used (ERC-20 token generator or ERC-20 tools)
2. Each function must have exactly the same parameters (no more, no less)
3. The parameters must be in the exact same order and type
   {% endhint %}
