SwapRouter02
Unichain0x73855d06de49d0fe4a9c42636ba96c62da12ff9c
Solidity v0.7.6+commit.7338295f
概览
读取函数
Returns the address of the WETH9 token used by the router.✨ AI
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | address | Returns the address of WETH9 |
Ensures that the current (synthetic) tick over the path is no worse than `maximumTickDivergence` ticks away from the average as of `secondsAgo`
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| 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 |
Ensures that the current (synthetic) tick over the path is no worse than `maximumTickDivergence` ticks away from the average as of `secondsAgo`
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| 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 |
The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | address | The contract address |
Returns the address of the V2 factory used by this router.✨ AI
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | address | Returns the address of the Uniswap V2 factory |
Returns the current address of the position manager used by the router.✨ AI
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | address | Returns the address of Uniswap V3 NFT position manager |
写入函数
Approves a token for the maximum possible amount
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| token | address | The token to approve |
Approves a token for the maximum possible amount minus one
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| token | address | The token to approve |
Approves a token for zero, then the maximum possible amount
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| token | address | The token to approve |
Approves a token for zero, then the maximum possible amount minus one
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| token | address | The token to approve |
Calls the position manager with arbitrary calldata
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| data | bytes | Calldata to pass along to the position manager |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| result | bytes | result The result from the call |
Swaps `amountIn` of one token for as much as possible of another along the specified path
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| params | tuple | The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| amountOut | uint256 | amountOut The amount of the received token |
Swaps `amountIn` of one token for as much as possible of another token
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| params | tuple | The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| amountOut | uint256 | amountOut The amount of the received token |
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.
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| params | tuple | The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| amountIn | uint256 | amountIn The amount of the input token |
Swaps as little as possible of one token for `amountOut` of another token that may remain in the router after the swap.
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| params | tuple | The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| amountIn | uint256 | amountIn The amount of the input token |
Return the approval type code required for transferring a given token amount.✨ AI
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| token | address | The token to approve |
| amount | uint256 | The amount to approve |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | uint8 | The required approval type |
Calls the position manager's increaseLiquidity function
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| params | tuple | Calldata to pass along to the position manager |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| result | bytes | result The result from the call |
Calls the position manager's mint function
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| params | tuple | Calldata to pass along to the position manager |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| result | bytes | result The result from the call |
Call multiple functions in the current contract and return the data from all of them if they all succeed
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| previousBlockhash | bytes32 | |
| data | bytes[] | The encoded function data for each of the calls to make to this contract |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | bytes[] | results The results from each of the calls passed in via data |
Call multiple functions in the current contract and return the data from all of them if they all succeed
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| 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 |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | bytes[] | results The results from each of the calls passed in via data |
Call multiple functions in the current contract and return the data from all of them if they all succeed
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| data | bytes[] | The encoded function data for each of the calls to make to this contract |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| results | bytes[] | results The results from each of the calls passed in via data |
Transfers the specified amount of a token from the msg.sender to address(this)
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| token | address | The token to pull |
| value | uint256 | The amount to pay |
Refunds any ETH balance held by this contract to the `msg.sender`
Permits this contract to spend a given token from `msg.sender`
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| 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` |
Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| 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` |
Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| 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` |
Permits this contract to spend a given token from `msg.sender`
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| 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` |
Swaps `amountIn` of one token for as much as possible of another token
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| 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 |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| amountOut | uint256 | amountOut The amount of the received token |
Swaps as little as possible of one token for an exact amount of another token
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| 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 |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| amountIn | uint256 | amountIn The amount of token to pay |
Transfers the full amount of a token held by this contract to msg.sender
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| token | address | The contract address of the token which will be transferred to msg.sender |
| amountMinimum | uint256 | The minimum amount of token required for a transfer |
| recipient | address |
Transfers the full amount of a token held by this contract to msg.sender
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| token | address | The contract address of the token which will be transferred to msg.sender |
| amountMinimum | uint256 | The minimum amount of token required for a transfer |
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
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| token | address | |
| amountMinimum | uint256 | |
| feeBips | uint256 | |
| feeRecipient | address |
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
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| token | address | |
| amountMinimum | uint256 | |
| recipient | address | |
| feeBips | uint256 | |
| feeRecipient | address |
Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| 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 |
Unwraps the contract's WETH9 balance and sends it to msg.sender as ETH.
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| amountMinimum | uint256 | The minimum amount of WETH9 to unwrap |
| recipient | address |
Unwraps the contract's WETH9 balance and sends it to msg.sender as ETH.
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| amountMinimum | uint256 | The minimum amount of WETH9 to unwrap |
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
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| amountMinimum | uint256 | |
| recipient | address | |
| feeBips | uint256 | |
| feeRecipient | address |
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
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| amountMinimum | uint256 | |
| feeBips | uint256 | |
| feeRecipient | address |
Wraps the contract's ETH balance into WETH9
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| value | uint256 | The amount of ETH to wrap |