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
  • getPair
  • allPairs
  • allPairsLength
  • feeTo
  • feeToSetter
  • Write functions
  • createPair
  • setFeeTo
  • setFeeToSetter
  • Events
  • PairCreated
  • Interface
  1. Developers
  2. Smart Contracts

PenguinSwap v2

PreviousSmart ContractsNextRouter v2

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: PenguinSwap Contract address:

View PenguinSwap.sol on GitHub.

View the PenguinSwap v2 contract on UltronScan.

Read functions

getPair

function getPair(address tokenA, address tokenB) external view returns (address pair);

Address for tokenA and address for tokenB return address of pair contract (where one exists).

tokenA and tokenB order is interchangeable.

Returns 0x0000000000000000000000000000000000000000 as address where no pair exists.

allPairs

function allPairs(uint) external view returns (address pair);

Returns the address of the nth pair (0-indexed) created through the Factory contract.

Returns 0x0000000000000000000000000000000000000000 where pair has not yet been created.

Begins at 0 for first created pair.

allPairsLength

function allPairsLength() external view returns (uint);

Displays the current number of pairs created through the Factory contract as an integer.

feeTo

function feeTo() external view returns (address);

The address to where non-LP-holder fees are sent.

feeToSetter

function feeToSetter() external view returns (address);

The address with permission to set the feeTo address.

Write functions

createPair

function createPair(address tokenA, address tokenB) external returns (address pair);

Creates a pair for tokenA and tokenB where a pair doesn't already exist.

tokenA and tokenB order is interchangeable.

Emits PairCreated (see Events).

setFeeTo

Sets address for feeTo.

setFeeToSetter

Sets address for permission to adjust feeTo.

Events

PairCreated

event PairCreated(address indexed token0, address indexed token1, address pair, uint);

Emitted whenever a createPair creates a new pair.

token0 will appear before token1 in sort order.

The final uint log value will be 1 for the first pair created, 2 for the second, etc.

Interface

import '@uniswap/v2-core/contracts/interfaces/IPenguinSwap.sol';
pragma solidity =0.5.16;


interface IPenguinSwap {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}
Uniswap v2 documentation
Uniswap v2 Core whitepaper