SwapRouter

Linea

0x8be024b5c546b5d45cbb23163e1a4dca8fa5052a

Solidity v0.8.28+commit.7893614a

🤖
透過你的 AI 查詢此合約
參考: 0x8be024b5c546b5d45cbb23163e1a4dca8fa5052a
範例提示詞: "Tell me the current state of linea/0x8be024b5c546b5d45cbb23163e1a4dca8fa5052a"
還沒有接入 AI?→ mcp.smarts.md
Linea 在 Smarts 上是僅文件鏈:原始碼和 ABI 已索引,但目前不提供即時鏈上資料(狀態、最新事件、管理員概覽)。AI 代理仍可透過 MCP 呼叫 get_contract_info 和 get_contract_source。

概覽

讀取函式
2
寫入函式
15
事件
0

讀取函式

WETH9() view

Returns the WETH9 token contract address used by the router.✨ AI

回傳值

名稱 類型 描述
address Returns the address of WETH9
deployer() view

Provides the address of the account that deployed this contract.✨ AI

回傳值

名稱 類型 描述
address Returns the address of the Uniswap V3 deployer

寫入函式

exactInput(params: tuple) payable

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
exactInputSingle(params: tuple) payable

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
exactOutput(params: tuple) payable

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
exactOutputSingle(params: tuple) payable

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
multicall(data: bytes[]) payable

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

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

參數

名稱 類型 描述
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
refundETH() payable

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

開發者: 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`

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

參數

名稱 類型 描述
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

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

參數

名稱 類型 描述
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

開發者: 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.

參數

名稱 類型 描述
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`

開發者: 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

參數

名稱 類型 描述
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`
sweepToken(token: address, amountMinimum: uint256, recipient: address) payable

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

開發者: The amountMinimum parameter prevents malicious contracts from stealing the token from users

參數

名稱 類型 描述
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
sweepTokenWithFee(token: address, amountMinimum: uint256, recipient: address, feeBips: uint256, feeRecipient: address) payable

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

開發者: The amountMinimum parameter prevents malicious contracts from stealing the token from users

參數

名稱 類型 描述
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.

開發者: 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.

參數

名稱 類型 描述
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.

開發者: The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users.

參數

名稱 類型 描述
amountMinimum uint256 The minimum amount of WETH9 to unwrap
recipient address The address receiving ETH
unwrapWETH9WithFee(amountMinimum: uint256, recipient: address, feeBips: uint256, feeRecipient: address) payable

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

開發者: The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users.

參數

名稱 類型 描述
amountMinimum uint256
recipient address
feeBips uint256
feeRecipient address