RCPSwap
  • Introduction
  • Protocol Overview
    • How Uniswap works
    • Ecosystem Participants
    • Smart Contract
      • Factory
      • Pair
      • Pair (ERC-20)
      • Library
      • Router02
    • Glossary
  • Core Concepts
    • Swaps
    • Pools
    • Flash Swaps
    • Oracles
  • Advanced Topics
    • Fees
    • Pricing
    • Understanding Returns
    • Security
    • Math
    • Research
Powered by GitBook
On this page
  • Code
  • Address
  • Events
  • Mint
  • Burn
  • Swap
  • Sync
  • Read-Only Functions
  • MINIMUM_LIQUIDITY
  • factory
  • token0
  • token1
  • getReserves
  • price0CumulativeLast
  • price1CumulativeLast
  • kLast
  • State-Changing Functions
  • mint
  • burn
  • swap
  • skim
  • sync
  • Interface
  • ABI
  1. Protocol Overview
  2. Smart Contract

Pair

PreviousFactoryNextPair (ERC-20)

Last updated 2 years ago

This documentation covers Uniswap-specific functionality. For ERC-20 functionality, see .

Code

Address

See .

Events

Mint

event Mint(address indexed sender, uint amount0, uint amount1);Copy

Emitted each time liquidity tokens are created via .

Burn

event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);Copy

Emitted each time liquidity tokens are destroyed via .

Swap

event Swap(  address indexed sender,  uint amount0In,  uint amount1In,  uint amount0Out,  uint amount1Out,  address indexed to);Copy

Sync

event Sync(uint112 reserve0, uint112 reserve1);Copy

Read-Only Functions

MINIMUM_LIQUIDITY

function MINIMUM_LIQUIDITY() external pure returns (uint);Copy

factory

function factory() external view returns (address);Copy

token0

function token0() external view returns (address);Copy

Returns the address of the pair token with the lower sort order.

token1

function token1() external view returns (address);Copy

Returns the address of the pair token with the higher sort order.

getReserves

function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);Copy

price0CumulativeLast

function price0CumulativeLast() external view returns (uint);Copy

price1CumulativeLast

function price1CumulativeLast() external view returns (uint);Copy

kLast

function kLast() external view returns (uint);Copy

State-Changing Functions

mint

function mint(address to) external returns (uint liquidity);Copy

Creates pool tokens.

burn

function burn(address to) external returns (uint amount0, uint amount1);Copy

Destroys pool tokens.

swap

function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;Copy

skim

function skim(address to) external;Copy

sync

function sync() external;Copy

Interface

import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';Copy
pragma solidity >=0.5.0;interface IUniswapV2Pair {  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;  event Mint(address indexed sender, uint amount0, uint amount1);  event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);  event Swap(      address indexed sender,      uint amount0In,      uint amount1In,      uint amount0Out,      uint amount1Out,      address indexed to  );  event Sync(uint112 reserve0, uint112 reserve1);  function MINIMUM_LIQUIDITY() external pure returns (uint);  function factory() external view returns (address);  function token0() external view returns (address);  function token1() external view returns (address);  function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);  function price0CumulativeLast() external view returns (uint);  function price1CumulativeLast() external view returns (uint);  function kLast() external view returns (uint);  function mint(address to) external returns (uint liquidity);  function burn(address to) external returns (uint amount0, uint amount1);  function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;  function skim(address to) external;  function sync() external;}Copy

ABI

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

Emitted each time a swap occurs via .

Emitted each time reserves are updated via , , , or .

Returns 1000 for all pairs. See .

Returns the .

Returns the reserves of token0 and token1 used to price trades and distribute liquidity. See . Also returns the block.timestamp (mod 2**32) of the last block during which an interaction occured for the pair.

See .

See .

Returns the product of the reserves as of the most recent liquidity event. See .

Emits , , .

Emits , , .

Swaps tokens. For regular swaps, data.length must be 0. Also see .

Emits , .

See the .

See the .

Emits .

Pricing
Oracles
Oracles
Protocol Charge Calculation
Flash Swaps
whitepaper
whitepaper
https://unpkg.com/@uniswap/v2-core@1.0.0/build/IUniswapV2Pair.json
Pair (ERC-20)
UniswapV2Pair.sol
Pair Addresses
mint
burn
swap
mint
burn
swap
sync
Minimum Liquidity
Transfer
Mint
Sync
Transfer
Burn
Sync
Swap
Sync
Sync
factory address