路由合约
读函数
工厂
function factory() external pure returns (address);
返回规范地址 Factory.
给定输入,询问可能的输出
function getAmountOut(
uint amountIn,
uint reserveIn,
uint reserveOut,
uint24 fee
) public pure virtual override returns (uint amountOut)
给定输出,询问可能的输入
function getAmountIn(
uint amountOut,
uint reserveIn,
uint reserveOut,
uint24 fee
) public pure virtual override returns (uint amountIn)
给定输入,和一组路径,询问可能的输出
function getAmountsOut(
uint amountIn,
address[] memory path,
uint24[] memory fees
) public view virtual override returns (uint[] memory amounts)
给定输出,和一组路径,询问可能的输入
function getAmountsIn(
uint amountOut,
address[] memory path,
uint24[] memory fees
) public view virtual override returns (uint[] memory amounts)
quote
function quote(
uint amountA,
uint reserveA,
uint reserveB
) internal pure returns (uint amountB);
写函数
添加流动性(ERC20和ERC20交易对)
function addLiquidity(
address tokenA,
address tokenB,
uint24 fee,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
tokenA
address
The contract address of one token from your liquidity pair.
tokenB
address
The contract address of the other token from your liquidity pair.
fee
uint24
Transaction fee, optional values: 50(0.5%), 100(1%), 200(2%), 300(3%)
amountADesired
uint
The amount of tokenA you'd like to provide as liquidity.
amountBDesired
uint
The amount of tokenA you'd like to provide as liquidity.
amountAMin
uint
The minimum amount of tokenA to provide (slippage impact).
amountBMin
uint
The minimum amount of tokenB to provide (slippage impact).
to
address
Address of LP Token recipient.
deadline
uint
Unix timestamp deadline by which the transaction must confirm.
添加流动性(ERC20和WJU交易对)
Adds liquidity to a ERC20⇄WJU pool.
function addLiquidityETH(
address token,
uint24 fee,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
撤出流动性(ERC20和ERC20交易对)
function removeLiquidity(
address tokenA,
address tokenB,
uint24 fee,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
tokenA
address
The contract address of one token from your liquidity pair.
tokenB
address
The contract address of the other token from your liquidity pair.
fee
uint24
Transaction fee, optional values: 50(0.5%), 100(1%), 200(2%), 300(3%)
liquidity
uint
The amount of LP Tokens to remove.
amountAMin
uint
The minimum amount of the token to remove (slippage impact).
amountBMin
uint
The minimum amount of JU to remove (slippage impact).
to
address
Address of LP Token recipient.
deadline
uint
Unix timestamp deadline by which the transaction must confirm.
撤出流动性(ERC20和WJU交易对)
function removeLiquidityETH(
address token,
uint24 fee,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
token
address
The contract address of the token to remove liquidity.
fee
uint24
Transaction fee, optional values: 50(0.5%), 100(1%), 200(2%), 300(3%)
liquidity
uint
The amount of LP Tokens to remove.
amountTokenMin
uint
The minimum amount of the token to remove (slippage impact).
amountETHMin
uint
The minimum amount of JU to remove (slippage impact).
to
address
Address of LP Token recipient.
deadline
uint
Unix timestamp deadline by which the transaction must confirm.
撤出流动性并支持转账收取费用(ERC20和WJU交易对)
Removes liquidity from a ERC20⇄WJU for tokens that take a fee on transfer.
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint24 fee,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
token
address
The contract address of the token to remove liquidity.
fee
uint24
Transaction fee, optional values: 50(0.5%), 100(1%), 200(2%), 300(3%)
liquidity
uint
The amount of LP Tokens to remove.
amountTokenMin
uint
The minimum amount of the token to remove (slippage impact).
amountETHMin
uint
The minimum amount of JU to remove (slippage impact).
to
address
Address of LP Token recipient.
deadline
uint
Unix timestamp deadline by which the transaction must confirm.
从 ERC20⇄WJU 中移除流动性并通过许可证接收 JU,无需预先批准
function removeLiquidityETHWithPermit(
address token,
uint24 fee,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint amountToken, uint amountETH);
token
address
The contract address of the token to remove liquidity.
fee
uint24
Transaction fee, optional values: 50(0.5%), 100(1%), 200(2%), 300(3%)
liquidity
uint
The amount of LP Tokens to remove.
amountTokenMin
uint
The minimum amount of the token to remove (slippage impact).
amountETHMin
uint
The minimum amount of JU to remove (slippage impact).
to
address
Address of LP Token recipient.
deadline
uint
Unix timestamp deadline by which the transaction must confirm.
approveMax
bool
Whether or not the approval amount in the signature is for liquidity or uint(-1)
.
v
uint8
The v component of the permit signature.
r
bytes32
The r component of the permit signature.
s
bytes32
The s component of the permit signature.
从 ERC20⇄WJU 中移除流动性,并通过许可接收收取转账费用的代币的 JU
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint24 fee,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint amountETH);
token
address
The contract address of the token to remove liquidity.
fee
uint24
Transaction fee, optional values: 50(0.5%), 100(1%), 200(2%), 300(3%)
liquidity
uint
The amount of LP Tokens to remove.
amountTokenMin
uint
The minimum amount of the token to remove (slippage impact).
amountETHMin
uint
The minimum amount of JU to remove (slippage impact).
to
address
Address of LP Token recipient.
deadline
uint
Unix timestamp deadline by which the transaction must confirm.
approveMax
bool
Whether or not the approval amount in the signature is for liquidity or uint(-1)
.
v
uint8
The v component of the permit signature.
r
bytes32
The r component of the permit signature.
s
bytes32
The s component of the permit signature.
通过许可证,无需预先批准即可从 ERC20⇄ERC20 中移除流动性
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint amountA, uint amountB);
tokenA
address
The contract address of one token from your liquidity pair.
tokenB
address
The contract address of the other token from your liquidity pair.
fee
uint24
Transaction fee, optional values: 50(0.5%), 100(1%), 200(2%), 300(3%)
liquidity
uint
The amount of LP Tokens to remove.
amountTokenMin
uint
The minimum amount of the token to remove (slippage impact).
amountETHMin
uint
The minimum amount of JU to remove (slippage impact).
to
address
Address of LP Token recipient.
deadline
uint
Unix timestamp deadline by which the transaction must confirm.
approveMax
bool
Whether or not the approval amount in the signature is for liquidity or uint(-1)
.
v
uint8
The v component of the permit signature.
r
bytes32
The r component of the permit signature.
s
bytes32
The s component of the permit signature.
根据输入代币的精确数量接收尽可能多的输出代币
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
uint24[] calldata fees,
address to,
address referrer,
uint deadline
) external returns (uint[] memory amounts);
amountIn
uint
Payable amount of input tokens.
amountOutMin
uint
The minimum amount tokens to receive.
path (address[])
address
An array of token addresses. path.length
must be >= 2. Pools for each consecutive pair of addresses must exist and have liquidity.
fees
uint24
Transaction fee, optional values: 50(0.5%), 100(1%), 200(2%), 300(3%)
to
address
Address of recipient.
referrer
address
The previous level inviter of the transaction address.
deadline
uint
Unix timestamp deadline by which the transaction must confirm.
用尽可能少的输入代币获得精确数量的输出代币
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
uint24[] calldata fees,
address to,
address referrer,
uint deadline
) external returns (uint[] memory amounts);
amountOut
uint
Payable amount of input tokens.
amountInMax
uint
The maximum amount tokens to input.
path (address[])
address
An array of token addresses. path.length
must be >= 2. Pools for each consecutive pair of addresses must exist and have liquidity.
fees
uint
Transaction fee, optional values: 50(0.5%), 100(1%), 200(2%), 300(3%)
to
address
Address of recipient.
referrer
address
The previous level inviter of the transaction address.
deadline
uint
Unix timestamp deadline by which the transaction must confirm.
以精确数量的输入代币接收尽可能多的输出代币。支持转账收取手续费的代币。
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
uint24[] calldata fees,
address to,
address referrer,
uint deadline
) external;
amountIn
uint
Payable amount of input tokens.
amountOutMin
uint
The minimum amount tokens to receive.
path (address[])
address
An array of token addresses. path.length
must be >= 2. Pools for each consecutive pair of addresses must exist and have liquidity.
fees
uint24
Transaction fee, optional values: 50(0.5%), 100(1%), 200(2%), 300(3%)
to
address
Address of recipient.
referrer
address
The previous level inviter of the transaction address.
deadline
uint
Unix timestamp deadline by which the transaction must confirm.
以精确数量的 JU 接收尽可能多的输出代币
function swapExactETHForTokens(
uint amountOutMin,
address[] calldata path,
uint24[] calldata fees,
address to,
address referrer,
uint deadline
) external payable returns (uint[] memory amounts);
swapExactETHForTokens
uint
Payable JU amount.
amountOutMin
uint
The minimum amount tokens to receive.
path (address[])
address
An array of token addresses. path.length
must be >= 2. Pools for each consecutive pair of addresses must exist and have liquidity.
fees
uint24
Transaction fee, optional values: 50(0.5%), 100(1%), 200(2%), 300(3%)
to
address
Address of recipient.
referrer
address
The previous level inviter of the transaction address.
deadline
uint
Unix timestamp deadline by which the transaction must confirm.
用尽可能少的 JU 获得准确数量的输出代币
function swapETHForExactTokens(
uint amountOut,
address[] calldata path,
uint24[] calldata fees,
address to,
address referrer,
uint deadline
) external payable returns (uint[] memory amounts);
swapETHForExactTokens
uint
Payable JU amount.
amountOut
uint
The amount tokens to receive.
path (address[])
address
An array of token addresses. path.length
must be >= 2. Pools for each consecutive pair of addresses must exist and have liquidity.
fees
uint24
Transaction fee, optional values: 50(0.5%), 100(1%), 200(2%), 300(3%)
to
address
Address of recipient.
referrer
address
The previous level inviter of the transaction address.
deadline
uint
Unix timestamp deadline by which the transaction must confirm.
用一定数量的输入代币获得尽可能多的 JU
function swapExactTokensForETH(
uint amountIn,
uint amountOutMin,
address[] calldata path,
uint24[] calldata fees,
address to,
address referrer,
uint deadline
) external returns (uint[] memory amounts);
amountIn
uint
Payable amount of input tokens.
amountOutMin
uint
The minimum amount tokens to receive.
path (address[])
address
An array of token addresses. path.length
must be >= 2. Pools for each consecutive pair of addresses must exist and have liquidity.
fees
uint24
Transaction fee, optional values: 50(0.5%), 100(1%), 200(2%), 300(3%)
to
address
Address of recipient.
referrer
address
The previous level inviter of the transaction address.
deadline
uint
Unix timestamp deadline by which the transaction must confirm.
用尽可能少的输入代币获得准确数量的 JU
function swapTokensForExactETH(
uint amountOut,
uint amountInMax,
address[] calldata path,
uint24[] calldata fees,
address to,
address referrer,
uint deadline
) external returns (uint[] memory amounts);
amountOut
uint
Payable amount of input tokens.
amountInMax
uint
The minimum amount tokens to input.
path (address[])
address
An array of token addresses. path.length
must be >= 2. Pools for each consecutive pair of addresses must exist and have liquidity.
fees
uint24
Transaction fee, optional values: 50(0.5%), 100(1%), 200(2%), 300(3%)
to
address
Address of recipient.
referrer
address
The previous level inviter of the transaction address.
deadline
uint
Unix timestamp deadline by which the transaction must confirm.
以精确数量的 JU 接收尽可能多的输出代币,支持在转账时收取手续费的代币
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
uint24[] calldata fees,
address to,
address referrer,
uint deadline
) external payable;
swapExactETHForTokensSupportingFeeOnTransferTokens
uint
Payable JU amount.
amountOutMin
uint
The minimum amount tokens to receive.
path (address[])
address
An array of token addresses. path.length
must be >= 2. Pools for each consecutive pair of addresses must exist and have liquidity.
fees
uint24
Transaction fee, optional values: 50(0.5%), 100(1%), 200(2%), 300(3%)
to
address
Address of recipient.
referrer
address
The previous level inviter of the transaction address.
deadline
uint
Unix timestamp deadline by which the transaction must confirm.
Last updated