PenguinSwap
  • 🐧PenguinSwap Intro
  • Get Started
    • Create a Wallet
    • Get URC-20 Tokens
    • Using PenguinSwap without Centralized Exchanges
    • Connect Your Wallet to PenguinSwap
  • Click Here for Help
    • Troubleshooting Errors
    • General FAQ
    • Fixing Stuck Pending Transactions on BaseMeta
  • Contact Us
    • Business Partnerships
    • NFT Market Applications
    • Customer Support
    • Social Accounts & Communities
  • Roadmap
  • Brand & Logos
  • Products
    • 🔄Exchange
      • 🔃Token Swaps
      • How to Trade
      • Liquidity Pools
      • How to Add/Remove Liquidity
      • 📝Limit Orders
        • Limit Orders FAQ
      • ☮️Perpetual Trading
        • Perpetuals Glossary
        • What is Perpetual Trading?
        • How can I use it?
        • Perpetual Trading FAQ
    • ❄️Igloo Icing
      • How to use Igloo
      • How to use Igloo with UltronScan
    • 🍢Seafood Pools
      • How to Stake in Seafood Pools
      • Auto EGG Seafood Pool
      • Seafood Pool FAQ & Troubleshooting
    • 🌟Lottery
      • How to Play Lottery v2
      • Lottery FAQ
    • 📈Prediction
      • How to Use Prediction
      • Prediction FAQ
      • Prediction Troubleshooting
    • 🎃NFT Market
    • 🖼️NFT Profile System
      • How to Set Up an NFT Profile
      • Teams
    • ⛄IIO (Initial Igloo Offering)
      • How to Participate in an IIO
      • How to Participate in an IIO with UltronScan
      • Contract Details
    • Analytics (Info)
    • Voting
      • How to Vote
      • How to Vote with SafePal Wallet
    • Coming Soon
  • Tokenomics
    • 🥚EGG
      • EGG Tokenomics
      • Controlling EGG supply
  • Developers
    • Migration
      • Migrate Your Stakings
      • EGG Seafood Pool
    • Contributing
      • Codebase Overview
    • Bug Bounty
    • Smart Contracts
      • PenguinSwap v2
      • Router v2
      • Main Staking/Seafood Pool Contract
      • Prediction V2
      • Lottery v2
      • Auto EGG Seafood Pool (EggVault)
  • Hiring
    • Become a PEPE
      • Solidity Engineer
      • DevOps Engineer
      • Social Media Marketing Manager
      • Frontend Engineer
      • Blockchain QA Engineer
      • Communications/Public Relations Manager
      • Business Development Manager
Powered by GitBook
On this page
  • Contract info
  • Read functions
  • swap
  • getAmountOut
  • getAmountIn
  • getAmountsOut
  • getAmountsIn
  • quote
  • Write functions
  • addLiquidity
  • removeLiquidity
  1. Developers
  2. Smart Contracts

Router v2

PreviousPenguinSwap v2NextMain Staking/Seafood Pool Contract

Last updated 3 years ago

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

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 .

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.

Uniswap v2 documentation
Uniswap v2 Core whitepaper
Uniswap v2 Internal Functions documentation