ExactOutputSingle

Uniswap V3 Action Plugin - ExactOutputSingle

Description

Swaps as little as possible of one token for amountOut of another token

Method

exactOutputSingle((address,address,uint24,address,uint256,uint256,uint256,uint160))

Input Parameters

NamePlugin TypeDescription

to

FctAddress

Swap Router address

Method Parameters

NamePlugin TypeDescription

params.tuple

FctTuple

"Params.tuple" parameters

NamePlugin TypeRequired?Description

tokenIn

FctAddress

Token to spend

tokenOut

FctAddress

Token to receive

fee

FctValue24

Fee of the pool

amountOut

FctValue

Amount to receive in the swap

amountInMaximum

FctValue

Max amount to spend in the swap

sqrtPriceLimitX96

FctValue160

recipient

FctAddress

deadline

FctValue

Returned Values

NamePlugin TypeDescription

amountIn

FctValue

The amount of tokenIn spent in the swap

Example

Example with initParams

const exactOutputSingle = new UniswapV3.actions.ExactOutputSingle({
 chainId: 1,
 initParams: {
   to: "0x..." // Swap router
   methodParams: {
     "params.tuple": {
       tokenIn: "...",
       tokenOut: "...",
       fee: "...",
       amountOut: "...",
       amountInMaximum: "...",
       sqrtPriceLimitX96: "...",
       recipient: "...",
       deadline: "...",
     }
   }
 }
})

Example without initParams

const exactOutputSingle = new UniswapV3.actions.ExactOutputSingle({ chainId: 1 })

exactOutputSingle.input.set({
   to: "0x..." // Swap router
   methodParams: {
     "params.tuple": {
       tokenIn: "...",
       tokenOut: "...",
       fee: "...",
       amountOut: "...",
       amountInMaximum: "...",
       sqrtPriceLimitX96: "...",
       recipient: "...",
       deadline: "...",
     }
   }
})

Learn more

Learn more about Uniswap V3 ExactOutputSingle function here

Last updated