RemoveLiquidityETH

Uniswap Action Plugin - RemoveLiquidityETH

Description

Removes liquidity from an ERC-20⇄ERC-20 pool.

Method

removeLiquidityETH(address, uint256, uint256, uint256, address, uint256)

Input Parameters

NamePlugin TypeDescription

to

FctAddress

Uniswap V2 Router address

Method Parameters

NamePlugin TypeDescription

token

FctAddress

A pool token

liquidity

FctValue

The amount of liquidity tokens to remove.

amountTokenMin

FctValue

The minimum amount of token that must be received for the transaction not to revert.

amountETHMin

FctValue

The minimum amount of ETH that must be received for the transaction not to revert.

to

FctAddress

Recipient of the underlying assets.

deadline

FctValue

Unix timestamp after which the transaction will revert.

Returned Values

NamePlugin TypeDescription

amountA

FctValue

The amount of token received.

amountB

FctValue

The amount of ETH received.

Example

Example with initParams

const removeLiquidityETH = new Uniswap.actions.RemoveLiquidityETH({
 chainId: 1,
 initParams: {
   to: "0x..." // Uniswap V2 Router
   methodParams: {
     token: "0x...",
     liquidity: "...",
     amountTokenMin: "...",
     amountETHMin: "...",
     to: "0x...",
     deadline: "...",
   }
 }
})

Example without initParams

const removeLiquidityETH = new Uniswap.actions.RemoveLiquidityETH({ chainId: 1 })

removeLiquidityETH.input.set({
   to: "0x..." // Uniswap V2 Router
   value: "...",
   methodParams: {
     token: "0x...",
     liquidity: "...",
     amountTokenMin: "...",
     amountETHMin: "...",
     to: "0x...",
     deadline: "...",
   }
})

Learn more

Learn more about Uniswap RemoveLiquidityETH function here

Last updated