Adding Liquidity

The user can add liquidity on various liquidity pools on different dexes and earn pool fees. A pool is a pair of two tokens.

Step 1: Check the allowance of the pool contract on both tokens.

To initiate a swap, first determine if the DEX has the necessary allowance to access the tokens. This can be done using the following API endpoint:

API URL: https://api.expand.network/fungibletoken/getuserallowance


Sample Request:

https://api.expand.network/fungibletoken/getuserallowance?owner=0x6Fb447Ae94F5180254D436A693907a1f57696900&tokenAddress=0x6b175474e89094c44da98b954eedeac495271d0f&spender=0xBA12222222228d8Ba445958a75a0704d566BF2C8

Sample Response:

{
    "status": 200,
    "msg": "success",
    "data": {
        "allowance": "999000000000000000000"
    }
}

Step 2: Approve the pool contract from the tokens

This can be done using the following API endpoint:

API URL: https://api.expand.network/fungibletoken/approve


Sample Request:


Sample Response:

Step 3: Add Liquidity

This can be done using the following API endpoint:

API URL: https://api.expand.network/dex/addliquidity


Sample Request:


Sample Response:

The user will receive the LP tokens after adding liquidity to the pool.

Last updated