SwapRouter02

Ethereum Uniswap V3

0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45

Proxy implementation: 0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45

Solidity v0.7.6+commit.7338295f

🤖
Query this contract from your AI
Reference: univ3-swaprouter-eth 0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45
Sample prompt: “Tell me the current state of univ3-swaprouter-eth”
No AI wired up yet? → mcp.smarts.md

Admin & Risk

Who can change the rules?

Detected upgradeable and mintable controls from the verified ABI.

Upgradeable Mintable

Current controls

Implementation
0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45 ↗ Etherscan → smarts proxy

Overview

Read Functions
6
Write Functions
33
Events
0

Read Functions

Block #25,169,823 · just now
WETH9() view → 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

Returns

Name Type Description
address Returns the address of WETH9
checkOracleSlippage(paths: bytes[], amounts: uint128[], maximumTickDivergence: uint24, secondsAgo: uint32) view

Ensures that the current (synthetic) tick over the path is no worse than `maximumTickDivergence` ticks away from the average as of `secondsAgo`

Parameters

Name Type Description
paths bytes[]
amounts uint128[]
maximumTickDivergence uint24 The maximum number of ticks that the price can degrade by
secondsAgo uint32 The number of seconds ago to compute oracle prices against
checkOracleSlippage(path: bytes, maximumTickDivergence: uint24, secondsAgo: uint32) view

Ensures that the current (synthetic) tick over the path is no worse than `maximumTickDivergence` ticks away from the average as of `secondsAgo`

Parameters

Name Type Description
path bytes The path to fetch prices over
maximumTickDivergence uint24 The maximum number of ticks that the price can degrade by
secondsAgo uint32 The number of seconds ago to compute oracle prices against
factory() view → 0x1f98431c8ad98523631ae4a59f267346ea31f984

Returns

Name Type Description
address Returns the address of the Uniswap V3 factory
factoryV2() view → 0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f

Returns

Name Type Description
address Returns the address of the Uniswap V2 factory
positionManager() view → 0xc36442b4a4522e871399cd717abdd847ab11fe88

Returns

Name Type Description
address Returns the address of Uniswap V3 NFT position manager

Write Functions

approveMax(token: address) payable

Approves a token for the maximum possible amount

Parameters

Name Type Description
token address The token to approve
approveMaxMinusOne(token: address) payable

Approves a token for the maximum possible amount minus one

Parameters

Name Type Description
token address The token to approve
approveZeroThenMax(token: address) payable

Approves a token for zero, then the maximum possible amount

Parameters

Name Type Description
token address The token to approve
approveZeroThenMaxMinusOne(token: address) payable

Approves a token for zero, then the maximum possible amount minus one

Parameters

Name Type Description
token address The token to approve
callPositionManager(data: bytes) payable

Calls the position manager with arbitrary calldata

Parameters

Name Type Description
data bytes Calldata to pass along to the position manager

Returns

Name Type Description
result bytes result The result from the call
exactInput(params: tuple) payable

Swaps `amountIn` of one token for as much as possible of another along the specified path

dev: Setting `amountIn` to 0 will cause the contract to look up its own balance, and swap the entire amount, enabling contracts to send tokens before calling this function.

Parameters

Name Type Description
params tuple The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata

Returns

Name Type Description
amountOut uint256 amountOut The amount of the received token
exactInputSingle(params: tuple) payable

Swaps `amountIn` of one token for as much as possible of another token

dev: Setting `amountIn` to 0 will cause the contract to look up its own balance, and swap the entire amount, enabling contracts to send tokens before calling this function.

Parameters

Name Type Description
params tuple The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata

Returns

Name Type Description
amountOut uint256 amountOut The amount of the received token
exactOutput(params: tuple) payable

Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) that may remain in the router after the swap.

Parameters

Name Type Description
params tuple The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata

Returns

Name Type Description
amountIn uint256 amountIn The amount of the input token
exactOutputSingle(params: tuple) payable

Swaps as little as possible of one token for `amountOut` of another token that may remain in the router after the swap.

Parameters

Name Type Description
params tuple The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata

Returns

Name Type Description
amountIn uint256 amountIn The amount of the input token
getApprovalType(token: address, amount: uint256) nonpayable
dev: Lens to be called off-chain to determine which (if any) of the relevant approval functions should be called

Parameters

Name Type Description
token address The token to approve
amount uint256 The amount to approve

Returns

Name Type Description
uint8 The required approval type
increaseLiquidity(params: tuple) payable

Calls the position manager's increaseLiquidity function

Parameters

Name Type Description
params tuple Calldata to pass along to the position manager

Returns

Name Type Description
result bytes result The result from the call
mint(params: tuple) payable

Calls the position manager's mint function

Parameters

Name Type Description
params tuple Calldata to pass along to the position manager

Returns

Name Type Description
result bytes result The result from the call
multicall(previousBlockhash: bytes32, data: bytes[]) payable

Call multiple functions in the current contract and return the data from all of them if they all succeed

dev: The `msg.value` should not be trusted for any method callable from multicall.

Parameters

Name Type Description
previousBlockhash bytes32
data bytes[] The encoded function data for each of the calls to make to this contract

Returns

Name Type Description
bytes[] results The results from each of the calls passed in via data
multicall(deadline: uint256, data: bytes[]) payable

Call multiple functions in the current contract and return the data from all of them if they all succeed

dev: The `msg.value` should not be trusted for any method callable from multicall.

Parameters

Name Type Description
deadline uint256 The time by which this function must be called before failing
data bytes[] The encoded function data for each of the calls to make to this contract

Returns

Name Type Description
bytes[] results The results from each of the calls passed in via data
multicall(data: bytes[]) payable

Call multiple functions in the current contract and return the data from all of them if they all succeed

dev: The `msg.value` should not be trusted for any method callable from multicall.

Parameters

Name Type Description
data bytes[] The encoded function data for each of the calls to make to this contract

Returns

Name Type Description
results bytes[] results The results from each of the calls passed in via data
pull(token: address, value: uint256) payable

Transfers the specified amount of a token from the msg.sender to address(this)

Parameters

Name Type Description
token address The token to pull
value uint256 The amount to pay
refundETH() payable

Refunds any ETH balance held by this contract to the `msg.sender`

dev: Useful for bundling with mint or increase liquidity that uses ether, or exact output swaps that use ether for the input amount
selfPermit(token: address, value: uint256, deadline: uint256, v: uint8, r: bytes32, s: bytes32) payable

Permits this contract to spend a given token from `msg.sender`

dev: The `owner` is always msg.sender and the `spender` is always address(this).

Parameters

Name Type Description
token address The address of the token spent
value uint256 The amount that can be spent of token
deadline uint256 A timestamp, the current blocktime must be less than or equal to this timestamp
v uint8 Must produce valid secp256k1 signature from the holder along with `r` and `s`
r bytes32 Must produce valid secp256k1 signature from the holder along with `v` and `s`
s bytes32 Must produce valid secp256k1 signature from the holder along with `r` and `v`
selfPermitAllowed(token: address, nonce: uint256, expiry: uint256, v: uint8, r: bytes32, s: bytes32) payable

Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter

dev: The `owner` is always msg.sender and the `spender` is always address(this)

Parameters

Name Type Description
token address The address of the token spent
nonce uint256 The current nonce of the owner
expiry uint256 The timestamp at which the permit is no longer valid
v uint8 Must produce valid secp256k1 signature from the holder along with `r` and `s`
r bytes32 Must produce valid secp256k1 signature from the holder along with `v` and `s`
s bytes32 Must produce valid secp256k1 signature from the holder along with `r` and `v`
selfPermitAllowedIfNecessary(token: address, nonce: uint256, expiry: uint256, v: uint8, r: bytes32, s: bytes32) payable

Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter

dev: The `owner` is always msg.sender and the `spender` is always address(this) Can be used instead of #selfPermitAllowed to prevent calls from failing due to a frontrun of a call to #selfPermitAllowed.

Parameters

Name Type Description
token address The address of the token spent
nonce uint256 The current nonce of the owner
expiry uint256 The timestamp at which the permit is no longer valid
v uint8 Must produce valid secp256k1 signature from the holder along with `r` and `s`
r bytes32 Must produce valid secp256k1 signature from the holder along with `v` and `s`
s bytes32 Must produce valid secp256k1 signature from the holder along with `r` and `v`
selfPermitIfNecessary(token: address, value: uint256, deadline: uint256, v: uint8, r: bytes32, s: bytes32) payable

Permits this contract to spend a given token from `msg.sender`

dev: The `owner` is always msg.sender and the `spender` is always address(this). Can be used instead of #selfPermit to prevent calls from failing due to a frontrun of a call to #selfPermit

Parameters

Name Type Description
token address The address of the token spent
value uint256 The amount that can be spent of token
deadline uint256 A timestamp, the current blocktime must be less than or equal to this timestamp
v uint8 Must produce valid secp256k1 signature from the holder along with `r` and `s`
r bytes32 Must produce valid secp256k1 signature from the holder along with `v` and `s`
s bytes32 Must produce valid secp256k1 signature from the holder along with `r` and `v`
swapExactTokensForTokens(amountIn: uint256, amountOutMin: uint256, path: address[], to: address) payable

Swaps `amountIn` of one token for as much as possible of another token

dev: Setting `amountIn` to 0 will cause the contract to look up its own balance, and swap the entire amount, enabling contracts to send tokens before calling this function.

Parameters

Name Type Description
amountIn uint256 The amount of token to swap
amountOutMin uint256 The minimum amount of output that must be received
path address[] The ordered list of tokens to swap through
to address The recipient address

Returns

Name Type Description
amountOut uint256 amountOut The amount of the received token
swapTokensForExactTokens(amountOut: uint256, amountInMax: uint256, path: address[], to: address) payable

Swaps as little as possible of one token for an exact amount of another token

Parameters

Name Type Description
amountOut uint256 The amount of token to swap for
amountInMax uint256 The maximum amount of input that the caller will pay
path address[] The ordered list of tokens to swap through
to address The recipient address

Returns

Name Type Description
amountIn uint256 amountIn The amount of token to pay
sweepToken(token: address, amountMinimum: uint256, recipient: address) payable

Transfers the full amount of a token held by this contract to recipient

dev: The amountMinimum parameter prevents malicious contracts from stealing the token from users

Parameters

Name Type Description
token address The contract address of the token which will be transferred to `recipient`
amountMinimum uint256 The minimum amount of token required for a transfer
recipient address The destination address of the token
sweepToken(token: address, amountMinimum: uint256) payable

Transfers the full amount of a token held by this contract to recipient

dev: The amountMinimum parameter prevents malicious contracts from stealing the token from users

Parameters

Name Type Description
token address The contract address of the token which will be transferred to `recipient`
amountMinimum uint256 The minimum amount of token required for a transfer
sweepTokenWithFee(token: address, amountMinimum: uint256, feeBips: uint256, feeRecipient: address) payable

Transfers the full amount of a token held by this contract to msg.sender, with a percentage between 0 (exclusive) and 1 (inclusive) going to feeRecipient

dev: The amountMinimum parameter prevents malicious contracts from stealing the token from users

Parameters

Name Type Description
token address
amountMinimum uint256
feeBips uint256
feeRecipient address
sweepTokenWithFee(token: address, amountMinimum: uint256, recipient: address, feeBips: uint256, feeRecipient: address) payable

Transfers the full amount of a token held by this contract to msg.sender, with a percentage between 0 (exclusive) and 1 (inclusive) going to feeRecipient

dev: The amountMinimum parameter prevents malicious contracts from stealing the token from users

Parameters

Name Type Description
token address
amountMinimum uint256
recipient address
feeBips uint256
feeRecipient address
uniswapV3SwapCallback(amount0Delta: int256, amount1Delta: int256, _data: bytes) nonpayable

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

dev: 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

Name Type Description
amount0Delta int256 The 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.
amount1Delta int256 The 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.
_data bytes
unwrapWETH9(amountMinimum: uint256, recipient: address) payable

Unwraps the contract's WETH9 balance and sends it to recipient as ETH.

dev: The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users.

Parameters

Name Type Description
amountMinimum uint256 The minimum amount of WETH9 to unwrap
recipient address The address receiving ETH
unwrapWETH9(amountMinimum: uint256) payable

Unwraps the contract's WETH9 balance and sends it to recipient as ETH.

dev: The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users.

Parameters

Name Type Description
amountMinimum uint256 The minimum amount of WETH9 to unwrap
unwrapWETH9WithFee(amountMinimum: uint256, recipient: address, feeBips: uint256, feeRecipient: address) payable

Unwraps the contract's WETH9 balance and sends it to msg.sender as ETH, with a percentage between 0 (exclusive), and 1 (inclusive) going to feeRecipient

dev: The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users.

Parameters

Name Type Description
amountMinimum uint256
recipient address
feeBips uint256
feeRecipient address
unwrapWETH9WithFee(amountMinimum: uint256, feeBips: uint256, feeRecipient: address) payable

Unwraps the contract's WETH9 balance and sends it to msg.sender as ETH, with a percentage between 0 (exclusive), and 1 (inclusive) going to feeRecipient

dev: The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users.

Parameters

Name Type Description
amountMinimum uint256
feeBips uint256
feeRecipient address
wrapETH(value: uint256) payable

Wraps the contract's ETH balance into WETH9

dev: The resulting WETH9 is custodied by the router, thus will require further distribution

Parameters

Name Type Description
value uint256 The amount of ETH to wrap