FraxswapRouter

Fraxtal

0x7ae2a0f3d9ef911a0a3f726fa9fbfca25dc18f7a

Solidity v0.8.30+commit.73712a01

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

概覽

讀取函式
9
寫入函式
19
事件
0

讀取函式

INIT_CODE_HASH() pure

Returns the init code hash used to compute deterministic pair contract addresses.✨ AI

回傳值

名稱 類型 描述
hash bytes hash: bytes - keccak256 hash of the pair contract init code used for CREATE2 address derivation.✨ AI
WETH() view

Returns the address of the Wrapped Ether (WETH) token used by the router.✨ AI

回傳值

名稱 類型 描述
address The address of the WETH token contract used for wrapped ETH operations.✨ AI
factory() view

Returns the address of the Fraxswap factory contract.✨ AI

回傳值

名稱 類型 描述
address The factory contract address used by this router.✨ AI
getAmountIn(amountOut: uint256, reserveIn: uint256, reserveOut: uint256) pure

Calculate the minimum input token amount required to obtain a specified output from a liquidity pair.✨ AI

參數

名稱 類型 描述
amountOut uint256 Desired amount of output token to receive.✨ AI
reserveIn uint256 Reserve amount of the input token in the pair.✨ AI
reserveOut uint256 Reserve amount of the output token in the pair.✨ AI

回傳值

名稱 類型 描述
amountIn uint256 amountIn: Minimum input token amount to supply to receive amountOut, derived from the pair reserves and fee.✨ AI
getAmountOut(amountIn: uint256, reserveIn: uint256, reserveOut: uint256) pure

Return the amount of output tokens for a given input amount and pool reserves.✨ AI

參數

名稱 類型 描述
amountIn uint256 Amount of input tokens provided for the swap.✨ AI
reserveIn uint256 Current reserve amount of the input token in the pool.✨ AI
reserveOut uint256 Current reserve amount of the output token in the pool.✨ AI

回傳值

名稱 類型 描述
amountOut uint256 amountOut: Calculated output token amount obtainable from the swap using the pool's constant-product formula.✨ AI
getAmountsIn(amountOut: uint256, path: address[]) view

Compute the input token amounts required for each hop to receive a specified output amount.✨ AI

參數

名稱 類型 描述
amountOut uint256 Desired final token amount to receive.✨ AI
path address[] Ordered list of token addresses representing the swap route.✨ AI

回傳值

名稱 類型 描述
amounts uint256[] Array of token amounts required at each step of path; last equals amountOut and first is the required input amount.✨ AI
getAmountsOut(amountIn: uint256, path: address[]) view

Compute the output amounts for each hop in a multi-hop swap given an input amount and path.✨ AI

參數

名稱 類型 描述
amountIn uint256 Amount of the input token to start the swap (in token smallest units).✨ AI
path address[] Ordered list of token addresses defining the swap sequence from input to output.✨ AI

回傳值

名稱 類型 描述
amounts uint256[] Array of token amounts corresponding to each token in path; amounts[0] == amountIn and last is the final output amount.✨ AI
quote(amountA: uint256, reserveA: uint256, reserveB: uint256) pure

Return the equivalent amountB for a given amountA using the reserves' ratio.✨ AI

參數

名稱 類型 描述
amountA uint256 Input token A amount.✨ AI
reserveA uint256 Reserve of token A in the pair.✨ AI
reserveB uint256 Reserve of token B in the pair.✨ AI

回傳值

名稱 類型 描述
amountB uint256 amountB: Equivalent output amount of token B computed as amountA * reserveB / reserveA.✨ AI
version() view

Get the router contract version string.✨ AI

回傳值

名稱 類型 描述
string Router version string identifying the deployed implementation.✨ AI

寫入函式

addLiquidity(tokenA: address, tokenB: address, amountADesired: uint256, amountBDesired: uint256, amountAMin: uint256, amountBMin: uint256, to: address, deadline: uint256) nonpayable

Add liquidity to a token pair and mint LP tokens to the recipient.✨ AI

參數

名稱 類型 描述
tokenA address Address of the first token in the pair.✨ AI
tokenB address Address of the second token in the pair.✨ AI
amountADesired uint256 Desired amount of tokenA to add.✨ AI
amountBDesired uint256 Desired amount of tokenB to add.✨ AI
amountAMin uint256 Minimum amount of tokenA to accept (revert otherwise).✨ AI
amountBMin uint256 Minimum amount of tokenB to accept (revert otherwise).✨ AI
to address Recipient address that receives the minted liquidity tokens.✨ AI
deadline uint256 Unix timestamp after which the transaction will revert if not processed.✨ AI

回傳值

名稱 類型 描述
amountA uint256 amountA: Actual amount of tokenA that was added to the pool.✨ AI
amountB uint256 amountB: Actual amount of tokenB that was added to the pool.✨ AI
liquidity uint256 liquidity: Amount of liquidity (LP) tokens minted to the recipient.✨ AI
addLiquidityETH(token: address, amountTokenDesired: uint256, amountTokenMin: uint256, amountETHMin: uint256, to: address, deadline: uint256) payable

Adds liquidity to a token–ETH pair by depositing the specified token and ETH, and returns the amounts used and liquidity tokens minted.✨ AI

參數

名稱 類型 描述
token address Address of the ERC20 token to pair with ETH.✨ AI
amountTokenDesired uint256 Desired amount of token to add to the pair.✨ AI
amountTokenMin uint256 Minimum acceptable amount of token to add (slippage protection).✨ AI
amountETHMin uint256 Minimum acceptable amount of ETH to add (slippage protection).✨ AI
to address Address that will receive the minted liquidity tokens.✨ AI
deadline uint256 Timestamp after which the transaction will revert if not executed.✨ AI

回傳值

名稱 類型 描述
amountToken uint256 amountToken: Actual amount of token deposited into the pair.✨ AI
amountETH uint256 amountETH: Actual amount of ETH deposited into the pair.✨ AI
liquidity uint256 liquidity: Amount of liquidity tokens minted and sent to `to`.✨ AI
getAmountsInWithTwamm(amountOut: uint256, path: address[]) nonpayable

Compute the input token amounts required to receive a specified output along a swap path using TWAMM.✨ AI

參數

名稱 類型 描述
amountOut uint256 Desired output token amount for the final token in the path.✨ AI
path address[] Array of token addresses defining the swap route from the input to the output token.✨ AI

回傳值

名稱 類型 描述
amounts uint256[] amounts: uint256[] of required input amounts for each token in the path; amounts[0] is the initial input required.✨ AI
getAmountsOutWithTwamm(amountIn: uint256, path: address[]) nonpayable

Compute token output amounts for a given swap path using TWAMM logic.✨ AI

參數

名稱 類型 描述
amountIn uint256 Input token amount for the first token in path.✨ AI
path address[] Sequence of token addresses representing the swap route (length must be >= 2).✨ AI

回傳值

名稱 類型 描述
amounts uint256[] Array of amounts for each token in the path; amounts[0] equals amountIn and last element is the final output amount.✨ AI
removeLiquidity(tokenA: address, tokenB: address, liquidity: uint256, amountAMin: uint256, amountBMin: uint256, to: address, deadline: uint256) nonpayable

Removes liquidity for the token pair and transfers the underlying tokens to the recipient.✨ AI

參數

名稱 類型 描述
tokenA address Address of the first token in the pair.✨ AI
tokenB address Address of the second token in the pair.✨ AI
liquidity uint256 Amount of liquidity tokens to burn from the pair.✨ AI
amountAMin uint256 Minimum acceptable amount of tokenA to receive, or the call reverts.✨ AI
amountBMin uint256 Minimum acceptable amount of tokenB to receive, or the call reverts.✨ AI
to address Recipient address that will receive the withdrawn tokens.✨ AI
deadline uint256 Timestamp after which the transaction will revert if not processed.✨ AI

回傳值

名稱 類型 描述
amountA uint256 Amount of tokenA returned to the recipient.✨ AI
amountB uint256 Amount of tokenB returned to the recipient.✨ AI
removeLiquidityETH(token: address, liquidity: uint256, amountTokenMin: uint256, amountETHMin: uint256, to: address, deadline: uint256) nonpayable

Remove liquidity from the token–ETH pair, burn LP tokens, and return the underlying token and ETH to the recipient.✨ AI

參數

名稱 類型 描述
token address Address of the ERC20 token in the pair.✨ AI
liquidity uint256 Amount of LP tokens to burn and remove from the pool.✨ AI
amountTokenMin uint256 Minimum amount of token expected to receive (revert if less).✨ AI
amountETHMin uint256 Minimum amount of ETH expected to receive (revert if less).✨ AI
to address Recipient address that will receive the token and ETH.✨ AI
deadline uint256 Unix timestamp after which the transaction will revert.✨ AI

回傳值

名稱 類型 描述
amountToken uint256 Actual amount of token transferred to the recipient.✨ AI
amountETH uint256 Actual amount of ETH transferred to the recipient.✨ AI
removeLiquidityETHSupportingFeeOnTransferTokens(token: address, liquidity: uint256, amountTokenMin: uint256, amountETHMin: uint256, to: address, deadline: uint256) nonpayable

Remove liquidity from a token-ETH pair and send ETH while supporting fee-on-transfer tokens.✨ AI

參數

名稱 類型 描述
token address Address of the ERC-20 token in the token-ETH pair.✨ AI
liquidity uint256 Amount of liquidity tokens to remove.✨ AI
amountTokenMin uint256 Minimum amount of tokens to accept; revert if received less.✨ AI
amountETHMin uint256 Minimum amount of ETH to accept; revert if received less.✨ AI
to address Recipient address that will receive the ETH.✨ AI
deadline uint256 Unix timestamp after which the transaction will revert if not processed.✨ AI

回傳值

名稱 類型 描述
amountETH uint256 amountETH: Amount of ETH (in wei) returned to the recipient.✨ AI
removeLiquidityETHWithPermit(token: address, liquidity: uint256, amountTokenMin: uint256, amountETHMin: uint256, to: address, deadline: uint256, approveMax: bool, v: uint8, r: bytes32, s: bytes32) nonpayable

Remove liquidity from a token-ETH pair, burn LP tokens, and send token and ETH to the recipient using an EIP-2612 permit.✨ AI

開發者: Uses EIP-2612 permit (v,r,s) to approve router before removing liquidity; deadline must be >= current block timestamp.✨ AI

參數

名稱 類型 描述
token address Address of the ERC20 token paired with ETH.✨ AI
liquidity uint256 Amount of LP tokens to remove (in LP token units).✨ AI
amountTokenMin uint256 Minimum accepted amount of token to receive, else revert.✨ AI
amountETHMin uint256 Minimum accepted amount of ETH to receive, else revert.✨ AI
to address Recipient address that will receive the token and ETH.✨ AI
deadline uint256 Unix timestamp after which the permit and transaction are invalid.✨ AI
approveMax bool If true, permit approves max uint256 allowance; otherwise approves 'liquidity'.✨ AI
v uint8 Signature 'v' value for the permit (EIP-2612).✨ AI
r bytes32 Signature 'r' value for the permit (EIP-2612).✨ AI
s bytes32 Signature 's' value for the permit (EIP-2612).✨ AI

回傳值

名稱 類型 描述
amountToken uint256 amountToken: Actual amount of ERC20 token transferred to the recipient.✨ AI
amountETH uint256 amountETH: Actual amount of ETH transferred to the recipient.✨ AI
removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(token: address, liquidity: uint256, amountTokenMin: uint256, amountETHMin: uint256, to: address, deadline: uint256, approveMax: bool, v: uint8, r: bytes32, s: bytes32) nonpayable

Remove liquidity from a token–ETH pair using an off-chain permit, supporting fee-on-transfer tokens and send assets to a recipient.✨ AI

參數

名稱 類型 描述
token address Address of the ERC20 token in the token–ETH pair.✨ AI
liquidity uint256 Amount of LP tokens to remove.✨ AI
amountTokenMin uint256 Minimum amount of token to accept (slippage protection).✨ AI
amountETHMin uint256 Minimum amount of ETH to accept (slippage protection).✨ AI
to address Recipient address for returned tokens and ETH.✨ AI
deadline uint256 Unix timestamp after which the transaction will revert.✨ AI
approveMax bool If true, set permit allowance to uint256.max; otherwise use liquidity.✨ AI
v uint8 Signature parameter v for the permit.✨ AI
r bytes32 Signature parameter r for the permit.✨ AI
s bytes32 Signature parameter s for the permit.✨ AI

回傳值

名稱 類型 描述
amountETH uint256 amountETH: Amount of ETH (in wei) returned to the recipient.✨ AI
removeLiquidityWithPermit(tokenA: address, tokenB: address, liquidity: uint256, amountAMin: uint256, amountBMin: uint256, to: address, deadline: uint256, approveMax: bool, v: uint8, r: bytes32, s: bytes32) nonpayable

Remove liquidity from a token pair using an EIP-2612 permit and transfer the underlying tokens to the recipient.✨ AI

參數

名稱 類型 描述
tokenA address Address of the first token in the pair.✨ AI
tokenB address Address of the second token in the pair.✨ AI
liquidity uint256 Amount of LP tokens to burn.✨ AI
amountAMin uint256 Minimum acceptable amount of tokenA to receive (slippage protection).✨ AI
amountBMin uint256 Minimum acceptable amount of tokenB to receive (slippage protection).✨ AI
to address Recipient address for the withdrawn tokens.✨ AI
deadline uint256 Unix timestamp after which the transaction will revert.✨ AI
approveMax bool If true, use max uint256 allowance in the permit; otherwise use 'liquidity'.✨ AI
v uint8 Recovery byte of the permit signature.✨ AI
r bytes32 First 32 bytes of the permit signature.✨ AI
s bytes32 Second 32 bytes of the permit signature.✨ AI

回傳值

名稱 類型 描述
amountA uint256 amountA: Actual amount of tokenA sent to the recipient.✨ AI
amountB uint256 amountB: Actual amount of tokenB sent to the recipient.✨ AI
swapETHForExactTokens(amountOut: uint256, path: address[], to: address, deadline: uint256) payable

Swap ETH for an exact amount of tokens and send those tokens to the recipient.✨ AI

參數

名稱 類型 描述
amountOut uint256 Exact amount of output tokens the caller wants to receive.✨ AI
path address[] Array of token addresses to trade through; first element must be WETH and last the output token.✨ AI
to address Address that will receive the output tokens.✨ AI
deadline uint256 Unix timestamp after which the transaction will revert if not executed.✨ AI

回傳值

名稱 類型 描述
amounts uint256[] Array of token amounts for each address in path; first is the wrapped ETH input amount and last equals amountOut.✨ AI
swapExactETHForTokens(amountOutMin: uint256, path: address[], to: address, deadline: uint256) payable

Swap an exact amount of ETH for tokens along the given path and send the output tokens to the recipient.✨ AI

參數

名稱 類型 描述
amountOutMin uint256 Minimum acceptable amount of output tokens; revert if received amount is lower.✨ AI
path address[] Array of token addresses representing the swap route; first should be WETH, last is desired output token.✨ AI
to address Recipient address that will receive the output tokens.✨ AI
deadline uint256 Unix timestamp after which the transaction is invalid and will revert.✨ AI

回傳值

名稱 類型 描述
amounts uint256[] Amounts for each token in the path: amounts[0] is input ETH (as WETH) and amounts[last] is the output token amount sent to 'to'.✨ AI
swapExactETHForTokensSupportingFeeOnTransferTokens(amountOutMin: uint256, path: address[], to: address, deadline: uint256) payable

Swap exact ETH for tokens and send the tokens to the recipient while supporting fee-on-transfer tokens.✨ AI

參數

名稱 類型 描述
amountOutMin uint256 Minimum amount of output tokens that must be received for the transaction not to revert.✨ AI
path address[] Array of token addresses defining the swap route; first address is WETH wrapper, last is desired token.✨ AI
to address Recipient address that will receive the output tokens.✨ AI
deadline uint256 Unix timestamp after which the transaction will revert if not executed.✨ AI
swapExactTokensForETH(amountIn: uint256, amountOutMin: uint256, path: address[], to: address, deadline: uint256) nonpayable

Swap an exact amount of input tokens for ETH, require at least amountOutMin, and send ETH to the recipient before deadline.✨ AI

參數

名稱 類型 描述
amountIn uint256 Exact amount of input tokens to swap.✨ AI
amountOutMin uint256 Minimum amount of ETH to accept; revert if the output is below this.✨ AI
path address[] Array of token addresses representing the swap route; last address should be WETH.✨ AI
to address Recipient address that will receive the output ETH.✨ AI
deadline uint256 Unix timestamp after which the transaction will revert if not executed.✨ AI

回傳值

名稱 類型 描述
amounts uint256[] Array of token amounts for each hop (uint256[]), starting with amountIn and ending with ETH amount received.✨ AI
swapExactTokensForETHSupportingFeeOnTransferTokens(amountIn: uint256, amountOutMin: uint256, path: address[], to: address, deadline: uint256) nonpayable

Swap an exact amount of input tokens for ETH while supporting tokens that charge transfer fees.✨ AI

參數

名稱 類型 描述
amountIn uint256 Exact amount of input tokens to send.✨ AI
amountOutMin uint256 Minimum acceptable amount of ETH to receive, or revert.✨ AI
path address[] Array of token addresses to route the swap; last address is WETH.✨ AI
to address Recipient address that will receive the output ETH.✨ AI
deadline uint256 Unix timestamp after which the transaction will revert.✨ AI
swapExactTokensForTokens(amountIn: uint256, amountOutMin: uint256, path: address[], to: address, deadline: uint256) nonpayable

Swap an exact amount of input tokens for output tokens along a path, sending the results to the recipient.✨ AI

參數

名稱 類型 描述
amountIn uint256 Amount of input tokens to swap.✨ AI
amountOutMin uint256 Minimum acceptable amount of output tokens; transaction reverts if output is lower.✨ AI
path address[] Array of token addresses defining the swap route; path[0] is input token, last is output token.✨ AI
to address Recipient address that will receive the output tokens.✨ AI
deadline uint256 Unix timestamp after which the transaction will revert if not executed.✨ AI

回傳值

名稱 類型 描述
amounts uint256[] Array of token amounts for each hop in the path; amounts[0] == amountIn and the last element is the output received.✨ AI
swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn: uint256, amountOutMin: uint256, path: address[], to: address, deadline: uint256) nonpayable

Swap an exact amount of input tokens for output tokens along a path while supporting fee-on-transfer tokens.✨ AI

參數

名稱 類型 描述
amountIn uint256 Exact amount of input tokens to send.✨ AI
amountOutMin uint256 Minimum amount of output tokens required for the caller to accept the swap.✨ AI
path address[] Array of token addresses representing the swap route (input to output).✨ AI
to address Recipient address that will receive the output tokens.✨ AI
deadline uint256 Unix timestamp after which the transaction will revert if not yet executed.✨ AI
swapTokensForExactETH(amountOut: uint256, amountInMax: uint256, path: address[], to: address, deadline: uint256) nonpayable

Swap input tokens to receive an exact amount of ETH, spending no more than amountInMax.✨ AI

參數

名稱 類型 描述
amountOut uint256 Exact amount of ETH to receive (in wei).✨ AI
amountInMax uint256 Maximum amount of input tokens to spend (in token smallest units).✨ AI
path address[] Array of token addresses for the swap; path[0] is input token, last must be WETH.✨ AI
to address Recipient address that will receive the resulting ETH.✨ AI
deadline uint256 Unix timestamp after which the transaction will revert if not executed.✨ AI

回傳值

名稱 類型 描述
amounts uint256[] amounts: Array of token amounts for each hop; amounts[0] is input used and last equals amountOut (ETH).✨ AI
swapTokensForExactTokens(amountOut: uint256, amountInMax: uint256, path: address[], to: address, deadline: uint256) nonpayable

Swaps the minimum required input tokens to obtain an exact amount of output tokens.✨ AI

參數

名稱 類型 描述
amountOut uint256 Exact amount of output tokens desired.✨ AI
amountInMax uint256 Maximum amount of input tokens willing to spend.✨ AI
path address[] Array of token addresses representing the swap route (input to output).✨ AI
to address Recipient address that receives the output tokens.✨ AI
deadline uint256 Unix timestamp after which the transaction will revert if not executed.✨ AI

回傳值

名稱 類型 描述
amounts uint256[] amounts: array of token amounts for each hop; amounts[0] is actual input spent and the last equals the requested amountOut.✨ AI