SimpleRemoveLiquidity

Uniswap Action Plugin - SimpleRemoveLiquidity

Description

Removes liquidity on Uniswap V2

Method

Depends on the parameters, that have been provided. Either removeLiquidity or removeLiquidityETH

Input Parameters

NamePlugin TypeDescription

to

FctAddress

Uniswap V2 Router address

Method Parameters

NamePlugin TypeDescription

tokenA

FctAddress

TokenA pool token address

tokenB

FctAddress

TokenB pool token address

liquidity

FctValue

Amount that will be removed from the LP token

to

FctAddress

Recipient of the liquidity tokens.

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 simpleRemoveLiquidity = new Uniswap.actions.SimpleRemoveLiquidity({
 chainId: 1,
 initParams: {
   to: "0x...", // Uniswap V2 Router
   methodParams: {
     tokenA: "0x...",
     tokenB: "0x...",
     liquidity: "...",
     to: "0x...",
     deadline: "...",
   }
 }
})

Example without initParams

const simpleRemoveLiquidity = new Uniswap.actions.SimpleRemove({ chainId: 1 })

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

Learn more

Learn more about Uniswap AddLiquidity function here

Last updated