> For the complete documentation index, see [llms.txt](https://docs.20lab.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.20lab.app/decentralized-exchanges/custom-exchange.md).

# Custom exchange

<figure><img src="/files/PGGVts94lnXFynZh8qkM" 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 %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.20lab.app/decentralized-exchanges/custom-exchange.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.
