RemoveLiquidity

Uniswap Action Plugin - RemoveLiquidity

Description

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

Method

removeLiquidity(address, address, uint256, uint256, uint256, address, uint256)

Input Parameters

NamePlugin TypeDescription

to

FctAddress

Uniswap V2 Router address

Method Parameters

NamePlugin TypeDescription

tokenA

FctAddress

A pool token

tokenB

FctAddress

A pool token

liquidity

FctValue

The amount of liquidity tokens to remove.

amountAMin

FctValue

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

amountBMin

FctValue

The minimum amount of tokenB 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 tokenA received.

amountB

FctValue

The amount of tokenB received.

Example

Example with initParams

const removeLiquidity = new Uniswap.actions.RemoveLiquidity({
 chainId: 1,
 initParams: {
   to: "0x..." // Uniswap V2 Router
   methodParams: {
     tokenA: "0x...",
     tokenB: "0x...",
     liquidity: "...",
     amountAMin: "...",
     amountBMin: "...",
     to: "0x...",
     deadline: "...",
   }
 }
})

Example without initParams

const removeLiquidity = new Uniswap.actions.RemoveLiquidity({ chainId: 1 })

removeLiquidity.input.set({
   to: "0x..." // Uniswap V2 Router
   value: "...",
   methodParams: {
     tokenA: "0x...",
     tokenB: "0x...",
     liquidity: "...",
     amountAMin: "...",
     amountBMin: "...",
     to: "0x...",
     deadline: "...",
   }
})

Learn more

Learn more about Uniswap RemoveLiquidity function here

Last updated