Skip to main content

UnoswapV3Router

Derives#

Functions#

constructor#

function constructor(  address weth) public

Parameters:#

NameTypeDescription
wethaddress

uniswapV3SwapToWithPermit#

function uniswapV3SwapToWithPermit(  address payable recipient,  contract IERC20 srcToken,  uint256 amount,  uint256 minReturn,  uint256[] pools,  bytes permit) external returns (uint256 returnAmount)

Same as uniswapV3SwapTo but calls permit first, allowing to approve token spending and make a swap in one transaction.

Parameters:#

NameTypeDescription
recipientaddress payableAddress that will receive swap funds
srcTokencontract IERC20Source token
amountuint256Amount of source tokens to swap
minReturnuint256Minimal allowed returnAmount to make transaction commit
poolsuint256[]Pools chain used for swaps. Pools src and dst tokens should match to make swap happen
permitbytesShould contain valid permit that can be used in IERC20Permit.permit calls. See tests for examples

uniswapV3Swap#

function uniswapV3Swap(  uint256 amount,  uint256 minReturn,  uint256[] pools) external returns (uint256 returnAmount)

Same as uniswapV3SwapTo but uses msg.sender as recipient

Parameters:#

NameTypeDescription
amountuint256Amount of source tokens to swap
minReturnuint256Minimal allowed returnAmount to make transaction commit
poolsuint256[]Pools chain used for swaps. Pools src and dst tokens should match to make swap happen

uniswapV3SwapTo#

function uniswapV3SwapTo(  address payable recipient,  uint256 amount,  uint256 minReturn,  uint256[] pools) public returns (uint256 returnAmount)

Performs swap using Uniswap V3 exchange. Wraps and unwraps ETH if required. Sending non-zero msg.value for anything but ETH swaps is prohibited

Parameters:#

NameTypeDescription
recipientaddress payableAddress that will receive swap funds
amountuint256Amount of source tokens to swap
minReturnuint256Minimal allowed returnAmount to make transaction commit
poolsuint256[]Pools chain used for swaps. Pools src and dst tokens should match to make swap happen

uniswapV3SwapCallback#

function uniswapV3SwapCallback(  int256 amount0Delta,  int256 amount1Delta,  bytes ) external

Called to msg.sender after executing a swap via IUniswapV3Pool#swap.

In the implementation you must pay the pool tokens owed for the swap. The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory. amount0Delta and amount1Delta can both be 0 if no tokens were swapped.

Parameters:#

NameTypeDescription
amount0Deltaint256The amount of token0 that was sent (negative) or must be received (positive) by the pool by the end of the swap. If positive, the callback must send that amount of token0 to the pool.
amount1Deltaint256The amount of token1 that was sent (negative) or must be received (positive) by the pool by the end of the swap. If positive, the callback must send that amount of token1 to the pool.
``bytesAny data passed through by the caller via the IUniswapV3PoolActions#swap call