Quickswap Documentation
  • πŸ‰What is Quickswap?
  • Overview
    • ♻️Quickswap AMM
    • πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦Ecosystem Participants
    • ✨Key Features
    • πŸ”Swap
    • πŸ’¦Pools
    • πŸ‘¨β€πŸŒΎFarms
    • 🀝Bonds
    • βš–οΈPerps
    • 🐲Dragon's Lair
    • πŸ›οΈGovernance
    • πŸ—ΊοΈRoadmap
    • πŸ“²Social Media
    • πŸ“Contracts & Addresses
  • Tokens
    • πŸͺ™QUICK
    • πŸͺ™DD
  • Networks & Wallets
    • ⛓️Supported Chains
    • πŸ’³Supported Wallets
  • How To Guides
    • πŸ”How To Swap
      • ℹ️dLIMIT Guide
      • ℹ️dTWAP Guide
    • πŸ’§LP (Liquidity Providing)
    • πŸ‘©β€πŸŒΎFarm
    • πŸ₯©Stake
  • πŸ’»Technical Reference
    • πŸ‘©β€πŸ’»API
      • API Overview
      • Entities
      • Queries
    • πŸ“œSmart Contracts
      • 2️⃣V2
        • Factory
        • Pair
        • Pair (ERC-20)
        • Library
        • Router02
        • Router01
        • Common Errors
      • 3️⃣V3
        • Position Manager
        • Factory
        • Pool Deployer
        • Quoter
        • V3 Migrator
        • Farming Center
        • Limit Farming
        • Pool
        • Audits
    • ⌨️SDK
      • Getting Started
      • Token
      • Pair
      • Route
      • Trade
      • Fractions
      • Fetcher
      • Other Exports
    • ❔Guides
      • Interface Integration
        • Using the API
        • Query Parameters
        • Iframe Integration
      • Javascript SDK
        • SDK Quick start
        • Fetching Data
        • Pricing
        • Trading
        • Pair Addresses
      • Smart Contract Integration
        • Smart Contract Quick Start
        • Implement A Swap
        • Providing Liquidity
        • Building An Oracle
        • Flash Swaps
        • V2 Pair Addresses
        • Supporting Meta Transactions
        • V3 Pool Addresses
    • πŸ”ŽSubgraphs
    • ℹ️Glossary
    • πŸ“–Core Concepts
      • Swaps
      • Pools
      • Flash Swaps
      • Oracles
    • βš–οΈAdvanced Topics
      • Fees
      • Pricing
      • Understanding Returns
      • Security
      • Math
      • Research
Powered by GitBook
On this page
  • Code
  • Events
  • Approval
  • Transfer
  • Read-Only Functions
  • name
  • symbol
  • decimals
  • totalSupply
  • balanceOf
  • allowance
  • DOMAIN_SEPARATOR
  • PERMIT_TYPEHASH
  • nonces
  • State-Changing Functions
  • approve
  • transfer
  • transferFrom
  • permit
  • Interface
  • ABI
  1. Technical Reference
  2. Smart Contracts
  3. V2

Pair (ERC-20)

PreviousPairNextLibrary

This documentation covers ERC-20 functionality for denominating pool tokens. For Uniswap-specific functionality, see Pair.

Code

Events

Approval

event Approval(address indexed owner, address indexed spender, uint value);

Emitted each time an approval occurs via approve or permit.

Transfer

event Transfer(address indexed from, address indexed to, uint value);

Emitted each time a transfer occurs via transfer, transferFrom, mint, or burn.

Read-Only Functions

name

function name() external pure returns (string memory);

Returns Uniswap V2 for all pairs.

symbol

function symbol() external pure returns (string memory);

Returns UNI-V2 for all pairs.

decimals

function decimals() external pure returns (uint8);

Returns 18 for all pairs.

totalSupply

function totalSupply() external view returns (uint);

Returns the total amount of pool tokens for a pair.

balanceOf

function balanceOf(address owner) external view returns (uint);

Returns the amount of pool tokens owned by an address.

allowance

function allowance(address owner, address spender) external view returns (uint);

Returns the amount of liquidity tokens owned by an address that a spender is allowed to transfer via transferFrom.

DOMAIN_SEPARATOR

function DOMAIN_SEPARATOR() external view returns (bytes32);

Returns a domain separator for use in permit.

PERMIT_TYPEHASH

function PERMIT_TYPEHASH() external view returns (bytes32);

Returns a typehash for use in permit.

nonces

function nonces(address owner) external view returns (uint);

Returns the current nonce for an address for use in permit.

State-Changing Functions

approve

function approve(address spender, uint value) external returns (bool);

Lets msg.sender set their allowance for a spender.

  • Emits Approval.

transfer

function transfer(address to, uint value) external returns (bool);

Lets msg.sender send pool tokens to an address.

  • Emits Transfer.

transferFrom

function transferFrom(address from, address to, uint value) external returns (bool);

Sends pool tokens from one address to another.

  • Requires approval.

  • Emits Transfer.

permit

function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

Sets the allowance for a spender where approval is granted via a signature.

  • See Using Permit.

  • Emits Approval.

Interface

import '@uniswap/v2-core/contracts/interfaces/IUniswapV2ERC20.sol';
pragma solidity >=0.5.0;

interface IUniswapV2ERC20 {
  event Approval(address indexed owner, address indexed spender, uint value);
  event Transfer(address indexed from, address indexed to, uint value);

  function name() external pure returns (string memory);
  function symbol() external pure returns (string memory);
  function decimals() external pure returns (uint8);
  function totalSupply() external view returns (uint);
  function balanceOf(address owner) external view returns (uint);
  function allowance(address owner, address spender) external view returns (uint);

  function approve(address spender, uint value) external returns (bool);
  function transfer(address to, uint value) external returns (bool);
  function transferFrom(address from, address to, uint value) external returns (bool);

  function DOMAIN_SEPARATOR() external view returns (bytes32);
  function PERMIT_TYPEHASH() external pure returns (bytes32);
  function nonces(address owner) external view returns (uint);

  function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}

ABI

import IUniswapV2ERC20 from '@uniswap/v2-core/build/IUniswapV2ERC20.json'

πŸ’»
πŸ“œ
2️⃣
UniswapV2ERC20.sol
https://unpkg.com/@uniswap/v2-core@1.0.0/build/IUniswapV2ERC20.json