Removing liquidity

To remove the liquidity from a pool, the user needs to provide LP 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: Remove Liquidity

This can be done using the following API endpoint:

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


Sample Request:


Sample Response:

Last updated