Router v2

PenguinSwap is based on Uniswap v2. Read the Uniswap v2 documentation. For more in-depth information on the core contract logic, read the Uniswap v2 Core whitepaper.

Contract info

Contract name: PenguinRouter Contract address:

View PenguinRouter.sol on GitHub.

View the PenguinSwap: Router v2 contract on UltronScan.

Read functions

swap

function factory() external pure returns (address);

Returns the canonical address for PenguinSwap.

For explanations of the following, view the Uniswap v2 Internal Functions documentation.

getAmountOut

function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut);

getAmountIn

function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn);

getAmountsOut

function getAmountsOut(uint amountIn, address[] memory path) internal view returns (uint[] memory amounts);

getAmountsIn

function getAmountsIn(uint amountOut, address[] memory path) internal view returns (uint[] memory amounts);

quote

function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB);

Write functions

addLiquidity

function addLiquidity(
  address tokenA,
  address tokenB,
  uint amountADesired,
  uint amountBDesired,
  uint amountAMin,
  uint amountBMin,
  address to,
  uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);

Adds liquidity to a URC20โ‡„URC20 pool.

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.

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.

removeLiquidity

function removeLiquidity(
  address tokenA,
  address tokenB,
  uint liquidity,
  uint amountAMin,
  uint amountBMin,
  address to,
  uint deadline
) external returns (uint amountA, uint amountB);

Removes liquidity from a URC20โ‡„URC20 pool.

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.

liquidity

uint

The amount of LP Tokens to remove.

amountAMin

uint

The minimum amount of tokenA to remove (slippage impact).

amountBMin

uint

The minimum amount of tokenB to remove (slippage impact).

to

address

Address of LP Token recipient.

deadline

uint

Unix timestamp deadline by which the transaction must confirm.

Last updated