Uniswap V3
Swap
- Label: Swap_UniswapV3
- Description: Swap a token to get another in exchange in Uniswap V3.
- Actions in execution process:
- Swap SELL_TOKENto getBUY_TOKENin exchange.
 
- Swap 
Note: If SELL_TOKEN or BUY_TOKEN is a native token, it gets wrapped before executing the following functions.
SELL_TOKEN · approve
Approve SwapRouter to spend SELL_TOKEN tokens on behalf of the avatar.
- 
Contract: SELL_TOKEN
- 
Function: approve(address,uint256)Parameter Constraint spenderSwapRouteramountequal to the SELL_TOKENamount to swap
TargetPool · Exchange
Swap amountIn of  SELL_TOKEN tokens for as much as possible of BUY_TOKEN tokens.
- Contract: SwapRouter
- Function: ExactInputSingle(address,address,uint24,address,uint256,uint256,uint160)
| Parameter | Constraint | 
|---|---|
| payableAmount | - | 
| params.tokenIn | equal to SELL_TOKENaddress | 
| params.tokenOut | equal to BUY_TOKENaddress | 
| params.fee | equal to “100” (in hundredths of basis points. e.g. the fee for a pool at the 0.3% tier is 3000; the fee for a pool at the 0.01% tier is 100) | 
| params.recipient | equal to AVATAR | 
| params.amountIn | equal to SELL_TOKENamount | 
| params.amountOutMinimum | equal to minimum amount of BUY_TOKENto receive | 
| params.sqrtPriceLimitX96 | equal to “0” |