Collect

Uniswap V3 Action Plugin - Collect

Description

Collects up to a maximum amount of fees owed to a specific position to the recipient

Method

collect((uint256,address,uint128,uint128))

Input Parameters

NamePlugin TypeDescription

to

FctAddress

Non-fungible Position Manager Address

Method Parameters

NamePlugin TypeDescription

params.tuple

FctTuple

"Params.tuple" parameters

NamePlugin TypeRequired?Description

tokenId

FctValue

The ID of the token

recipient

FctAddress

Address which receives the owed tokens

amount0Max

FctValue128

Max amount of token0 that can be collected. Default: Max uint256 value

amount1Max

FctValue128

Max amount of token1 that can be collected. Default: Max uint256 value

Returned Values

NamePlugin TypeDescription

amount0

FctValue

The amount of fees collected in token0

amount1

FctValue

The amount of fees collected in token1

Example

Example with initParams

const collect = new UniswapV3.actions.Collect({
 chainId: 1,
 initParams: {
   to: "0x..." // Non-fungible Position Manager
   methodParams: {
     "params.tuple": {
       tokenId: "...",
       recipient: "0x...",
       amount0Max: "...", 
       amount1Max: "...",
     }
   }
 }
})

Example without initParams

const collect = new UniswapV3.actions.Collect({ chainId: 1 })

collect.input.set({
   to: "0x..." // Non-fungible Position Manager
   methodParams: {
     "params.tuple": {
       tokenId: "...",
       recipient: "0x...",
       amount0Max: "...", 
       amount1Max: "...",
     }
   }
})

Learn more

Learn more about Uniswap Collect function here

Last updated