SwapRouter
Mantle0xcf43e529e8c3172c2d30af4c27319acd09ce504d
Solidity v0.7.6+commit.7338295f
概览
读取函数
Returns the address of the WETH9 token contract used by the router.✨ AI
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | address | Returns the address of WETH9 |
The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| — | address | The contract address |
写入函数
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)
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| 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
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| params | tuple | The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata |
返回值
| 名称 | 类型 | 描述 |
|---|---|---|
| amountIn | uint256 | amountIn The amount of the input token |
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 |
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` |
Transfers the full amount of a token held by this contract to recipient
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| 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 |
Transfers the full amount of a token held by this contract to recipient, 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 recipient as ETH.
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| amountMinimum | uint256 | The minimum amount of WETH9 to unwrap |
| recipient | address | The address receiving ETH |
Unwraps the contract's WETH9 balance and sends it to recipient as ETH, with a percentage between 0 (exclusive), and 1 (inclusive) going to feeRecipient
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| amountMinimum | uint256 | |
| recipient | address | |
| feeBips | uint256 | |
| feeRecipient | address |