Router Contract

Read Functions

factory

function factory() external pure returns (address);

Returns the canonical address for Factory.

getAmountOut

function getAmountOut(
        uint amountIn,
        uint reserveIn,
        uint reserveOut,
        uint24 fee
    ) public pure virtual override returns (uint amountOut)

getAmountIn

function getAmountIn(
        uint amountOut,
        uint reserveIn,
        uint reserveOut,
        uint24 fee
    ) public pure virtual override returns (uint amountIn)

getAmountsOut

function getAmountsOut(
        uint amountIn,
        address[] memory path,
        uint24[] memory fees
    ) public view virtual override returns (uint[] memory amounts) 

getAmountsIn

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);

Write functions

addLiquidity

Adds liquidity to a ERC20 ⇄ ERC20 pool

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.

addLiquidityETH

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);
Name
Type

addLiquidityETH

uint

The payable amount in JU.

token

address

The contract address of the token to add liquidity.

fee

uint24

Transaction fee, optional values: 50(0.5%), 100(1%), 200(2%), 300(3%)

amountTokenDesired

uint

The amount of the token you'd like to provide as liquidity.

amountTokenMin

uint

The minimum amount of the token to provide (slippage impact).

amountETHMin

uint

The minimum amount of JU to provide (slippage impact).

to

address

Address of LP Token recipient.

deadline

uint

Unix timestamp deadline by which the transaction must confirm.

removeLiquidity

Removes liquidity from a ERC20⇄ERC20 pool.

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.

removeLiquidityETH

Removes liquidity from a ERC20⇄WJU pool.

function removeLiquidityETH(
    address token,
    uint24 fee,
    uint liquidity,
    uint amountTokenMin,
    uint amountETHMin,
    address to,
    uint deadline
) external returns (uint amountToken, uint amountETH);
Name
Type

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.

removeLiquidityETHSupportingFeeOnTransferTokens

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);
Name
Type

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.

removeLiquidityETHWithPermit

Removes liquidity from a ERC20⇄WJU and receives JU, without pre-approval, via permit.

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);
Name
Type

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.

removeLiquidityETHWithPermitSupportingFeeOnTransferTokens

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);

Removes liquidity from a ERC20⇄WJU and receives JU via permit for tokens that take a fee on transfer.

Name
Type

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.

removeLiquidityWithPermit

Removes liquidity from a ERC20⇄ERC20, without pre-approval, via permit.

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);
Name
Type

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.

swapExactTokensForTokens

Receive as many output tokens as possible for an exact amount of input tokens.

function swapExactTokensForTokens(
    uint amountIn,
    uint amountOutMin,
    address[] calldata path,
    uint24[] calldata fees,
    address to,
    address referrer,
    uint deadline
) external returns (uint[] memory amounts);
Name
Type

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.

swapTokensForExactTokens

Receive an exact amount of output tokens for as few input tokens as possible.

function swapTokensForExactTokens(
    uint amountOut,
    uint amountInMax,
    address[] calldata path,
    uint24[] calldata fees,
    address to,
    address referrer,
    uint deadline
) external returns (uint[] memory amounts);
Name
Type

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.

swapExactTokensForTokensSupportingFeeOnTransferTokens

Receive as many output tokens as possible for an exact amount of input tokens. Supports tokens that take a fee on transfer.

function swapExactTokensForTokensSupportingFeeOnTransferTokens(  
    uint amountIn,  
    uint amountOutMin,  
    address[] calldata path,  
    uint24[] calldata fees,
    address to,
    address referrer,  
    uint deadline
) external;
Name
Type

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.

swapExactETHForTokens

Receive as many output tokens as possible for an exact amount of JU.

function swapExactETHForTokens(
    uint amountOutMin,
    address[] calldata path,
    uint24[] calldata fees,
    address to,
    address referrer,
    uint deadline
) external payable returns (uint[] memory amounts);
Name
Type

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.

swapETHForExactTokens

Receive an exact amount of output tokens for as little JU as possible.

function swapETHForExactTokens(
    uint amountOut,
    address[] calldata path,
    uint24[] calldata fees,
    address to,
    address referrer,
    uint deadline
) external payable returns (uint[] memory amounts);
Name
Type

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.

swapExactTokensForETH

Receive as much JU as possible for an exact amount of input tokens.

function swapExactTokensForETH(
    uint amountIn,
    uint amountOutMin,
    address[] calldata path,
    uint24[] calldata fees,
    address to,
    address referrer,
    uint deadline
) external returns (uint[] memory amounts);
Name
Type

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.

swapTokensForExactETH

Receive an exact amount of JU for as few input tokens as possible.

function swapTokensForExactETH(
    uint amountOut,
    uint amountInMax,
    address[] calldata path,
    uint24[] calldata fees,
    address to,
    address referrer,
    uint deadline
) external returns (uint[] memory amounts);
Name
Type

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.

swapExactETHForTokensSupportingFeeOnTransferTokens

Receive as many output tokens as possible for an exact amount of JU. Supports tokens that take a fee on transfer.

function swapExactETHForTokensSupportingFeeOnTransferTokens(  
    uint amountOutMin,  
    address[] calldata path,
    uint24[] calldata fees,  
    address to,  
    address referrer,
    uint deadline
) external payable;
Name
Type

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