yieldaggregator

Remove Liquidity

Withdraws tokens from a yield aggregator market, supporting advanced options like dual-token removal and slippage control. The response includes chain details, addresses, gas usage, and a unique reference ID for transaction tracking.

💡 Compute Unit Value: 120 (Fixed)

post/defi/v1/yieldaggregator/removeliquidity

Request

  • Base URL
    https://svc.blockdaemon.com
  • URL
    https://svc.blockdaemon.com/defi/v1/yieldaggregator/removeliquidity
  • Auth
    API key in header X-API-Key

Request body

yieldAggregatorId'5200' | '5201' | '5202' | '5203' | '5204'

A unique identifier to route the transaction to the appropriate yield aggregator instance. This parameter is optional if a default aggregator is used.

marketAddressstring required

The blockchain address of the liquidity pool or market where tokens will be deposited. This parameter directs the transaction to the correct pool within the yield aggregator.

tokenOutstring required

The token that the user wishes to receive as a result of the liquidity removal. This parameter specifies which output token is desired when liquidity is withdrawn from the pool.

amountInstring required

Amount of tokens to remove from the liquidity pool, specified in the token's smallest denomination (base units). Do not send human-readable decimal values. Examples: 1 WETH (18 decimals) = "1000000000000000000"; 1 USDC (6 decimals) = "1000000".

fromstring required

Blockchain address of the sender. For EVM chains, use a checksummed hex address (e.g., 0xABCDEF...). This address must hold sufficient balance and will sign the transaction.

isDualboolean

An optional flag indicating whether the liquidity removal should be executed in dual-token mode. If set to true, liquidity will be removed for both tokens in the pool according to the pool’s ratio; if false or omitted, only a single token (as specified by tokenOut) will be withdrawn.

slippagestring

The maximum allowable percentage deviation between the expected and executed swap price. Default is 1, meaning a 1% tolerance (acceptable range: 0 to 100).

enableAggregatorboolean

Enable swap aggregator functionality to facilitate swaps between tokens that are not directly convertible with the underlying asset. Set this boolean flag to true to activate advanced routing logic for such conversions.

gasstring

Maximum number of gas units to allocate for the transaction, as an integer string (e.g., '200000'). If omitted, gas is estimated automatically. Note: this is gas units, not wei or gwei.

gasPrioritystring

Specifies the desired gas fee priority (e.g., 'low', 'medium', or 'high'), which influences the transaction speed and cost.

enableFeeboolean

Flag to include a basis points fee transaction alongside the main transaction when set to true.

Example request

{
  "yieldAggregatorId": "5200",
  "marketAddress": "0xcdd26eb5eb2ce0f203a84553853667ae69ca29ce",
  "tokenOut": "0x4db99b79361f98865230f5702de024c69f629fec",
  "amountIn": "1000000000000000000",
  "from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "isDual": false,
  "slippage": "10",
  "enableAggregator": false,
  "gas": "100000",
  "gasPriority": "low",
  "enableFee": false
}

Response

Successful response

statusinteger
msgstring
dataobject

Example response

{
  "status": 200,
  "msg": "success",
  "data": {
    "chainId": "1",
    "from": "0xdae2f6eddda6fb4fb60cc02633de27e2b431b402",
    "to": "0x888888888889758F76e7103c6CbF23ABbF58F946",
    "value": "0",
    "gas": "1000000",
    "data": "0xb7d75b8b000000000000000000000000dae2f6eddda6fb4fb60cc02633de27e2b431b402000000000000000000000000b451a36c8b6b2eac77ad0737ba732818143a0e250000000000000000000000000000000000000000000000008ac7230489e800000000000000000000000000000000000000000000000000001a3314a2f53c7a6f0000000000000000000000000000000000000000000000010bfcf818602b1a92",
    "estimationCheck": "Returned error: execution reverted: ERC20: insufficient allowance",
    "referenceId": "a2b80241f98544579531de6190c45729"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.